Part Number Hot Search : 
F1004 74LCX CH162 Y7C15 MOC3022 471M1 SGA8543Z FN3612
Product Description
Full Text Search
 

To Download ST52T441FMPY Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  rev. 2.9 - november 2002 1/94 this is preliminary information on a new product now in development or undergoing evaluation. details are subject to change without notice. preliminary datasheet st52t400/t440/e440/t441 8-bit intelligent controller unit (icu) timer/pwm, analog comparator, triac/pwm timer, wdg ? memories n upto8kbyteseprom/otp n 128/256 bytes of ram n readout protection core n register file based architecture n 55 instructions n hardware multiplication and division n decision processor for the implementation of fuzzy logic algorithms clock and power supply n up to 20 mhz clock frequency. n on-chip power on reset (por) and brown out detector (bod) n power saving features interrupts n 6 interrupt vectors n top level external interrupt (int) i/o ports n 13 or 21 i/o pins configurable in input and output mode n high current sink/source in all pins. triac driver output can supply 50 ma peripherals n programmable 8-bit timer/pwms with internal 16-bit prescaler featuring: C pwm output C input capture C output compare C pulse generator mode n watchdog timer n 6-channels analog comparator with 16-bit timer (not available in st52t400) n triac/pwm driver timer with zero crossing detector and high current capability for: C pwm mode Cburstmode C phase angle partialization mode development tools n high level software tools n emulator n low cost programmer n gang programmer st52t400/t440/e440
st52t400/t440/e440/t441 2/94 legend : st52t400/t440/e440/t441 type list st52 device nvm (bytes) ram (bytes) timer/ pwm analog comparator triac driver/ pwm wdt por, bod pull up i/os package st52t400fmpy 1/2/4/8k 128/256 1no 1yesyes ye s 13 so20, pdip20 st52t400gmpy 1/2/4/8k 128/256 21 so28, pdip28 st52t440fmpy 1/2/4/8k 128/256 1 4ch 1yesyes 13 so20, pdip20 st52t440gmpy 1/2/4/8k 128/256 6ch 21 so28, pdip28 st52e440f3d6 8k 256 13 cdip20w st52e440g3d6 8k 256 21 cdip28w ST52T441FMPY 1/2/4/8k 128/256 1 4ch 1yesyesno 13 so20, pdip20 st52t441gmpy 1/2/4/8k 128/256 6ch 21 so28, pdip28 st52e441f3d6 8k 256 13 cdip20w st52e441g3d6 8k 256 21 cdip28w note: devices with 1-2k nvm have 128 ram; devices with 4-8k nvm have 256 ram common features st52t400 st52x440/st52x441 temperature range -40 to + 85 c -40 to + 85 c operating supply 2.7 to 5.5 v 4.5 to 5.5 v cpu frequency up to 20 mhz up to 20 mhz sales code: st52tnnncmpy memory type (t): f=flash, t=otp, e=eprom subfamily (nnn): 400, 410, 420, 430, 440, 441 pin count (c): y=16 pins, f=20 pins, g=28 pins, k=32/34 pins, j=42/44 pins memory size (m): 0=1 kb, 1=2 kb, 2=4 kb, 3=8 kb packages (p): b=pdip, d=cdip, m=pso, t=tqfp temperature (y): 0=+25, 1=0 +70, 3=-40 +125, 5=-10 +85, 6=-40 +85, 7=-40 +105
3/94 table of contents st52t400/t440/e440/t441 1generaldescription......................................... 7 1.1introduction...................................................................7 1.2 operational description .........................................................8 1.2.1memoryprogrammingphase................................................ 8 1.2.2workingmode............................................................ 8 1.3 pindescription...............................................................18 2internalarchitecture...................................... 19 2.1controlunitanddataprocessingunit.............................................19 2.1.1programcounter ........................................................ 19 2.1.2flags.................................................................. 21 2.2addressspaces..............................................................21 2.2.1ramandstack.......................................................... 22 2.2.2 input registers bench . . . ................................................. 22 2.2.3configurationregisters ................................................... 23 2.2.4outputregisters......................................................... 23 2.3fuzzycomputation............................................................25 2.3.1fuzzyinference ......................................................... 25 2.3.2fuzzyficationphase...................................................... 25 2.3.3inferencephase......................................................... 26 2.3.4defuzzyfication.......................................................... 26 2.3.5 input membership function ................................................ 27 2.3.6outputsingleton......................................................... 27 2.3.7fuzzyrules ............................................................ 27 2.4 arithmetic logic unit . . . ........................................................30 2.4.1 addressing modes ....................................................... 30 2.4.2instructiontypes ........................................................ 30 3epromprogramming........................................... 33 3.1epromprogrammingphaseprocedure...........................................34 3.1.1epromoperation....................................................... 35 3.1.2epromlocking......................................................... 35 3.1.3epromwriting ......................................................... 35 3.1.4epromreading/verifymarginmode ........................................ 35 3.1.5standbymode.......................................................... 36 3.1.6idcode................................................................ 36 3.2epromerasure...............................................................36 4interrupts.................................................. 37 4.1interruptoperation............................................................37 4.2 global interrupt request enabling ................................................38 4.3interruptsources .............................................................38 4.4 interrupt maskability . . . ........................................................38 table of contents
st52t400/t440/e440/t441 4/94 4.5interruptpriority ..............................................................40 4.6interruptsandlowpowermode..................................................41 4.7interruptreset..............................................................41 5clock,reset&powersavingmode.......................... 42 5.1clocksystem ................................................................42 5.2reset.......................................................................43 5.2.1externalreset .......................................................... 43 5.2.2resetoperation......................................................... 43 5.2.3power-onreset(por).................................................... 43 5.2.4brown-outdetector(bod)................................................. 44 5.3powersavingmodes ..........................................................44 5.3.1waitmode.............................................................. 44 5.3.2haltmode.............................................................. 44 6i/oports .................................................... 46 6.1introduction..................................................................46 6.2 input mode ..................................................................47 6.3outputmode.................................................................47 6.4alternatefunctions. ...........................................................48 6.5i/oportconfigurationregisters..................................................48 7 analog comparator (st52x440/441) ........................... 50 7.1analogmoduleoverview .......................................................50 7.2comparatormode.............................................................50 7.3a/dconvertermode...........................................................50 7.3.1operatingmodes ........................................................ 51 8watchdogtimer............................................. 54 8.1 functional description . ........................................................54 8.2registerdescription...........................................................55 9pwm/timer................................................... 56 9.1timermode..................................................................56 9.2pwmmode..................................................................57 9.3timerinterrupt ...............................................................59 10triac/pwmdriver ........................................... 63 10.1triac/pwmdriversetting.....................................................64 10.2pwmmodesettings..........................................................65 10.3burstmode.................................................................66 10.4phaseanglepartializationworkingmode.........................................68 11electricalcharacteristics ............................... 72 11.1parameterconditions.........................................................72 11.1.1minimumandmaximumvalues ............................................ 72 11.1.2typicalvalues.......................................................... 72 11.1.3typicalcurves.......................................................... 72 11.1.4 loading capacitor ....................................................... 72 11.1.5pininputvoltage........................................................ 72 11.2absolutemaximumratings ....................................................72
5/94 table of contents st52t400/t440/e440/t441 11.3 recommended operating condition. . . ...........................................74 11.4supplycurrentcharacteristics..................................................75 11.5brown-outdetectorcharacteristics ..............................................76 11.6clockandtimingcharacteristics................................................77 11.7memorycharacteristics .......................................................78 11.8esdpinprotectionstrategy....................................................79 11.8.1 standard pin protection . ................................................. 79 11.9portpincharacteristics .......................................................80 11.9.1 general characteristics . ................................................. 80 11.10..........................................................................82 11.11controlpincharacteristics ....................................................84 11.11.1 reset pin ........................................................... 84 11.11.2poweronreset........................................................ 84 11.11.3vpppin.............................................................. 84 11.12analogcomparatorcharacteristics .............................................85 11.13triacdrivercharacteristics....................................................85 orderinginformation........................................ 92
st52t400/t440/e440/t441 6/94
st52t400/t440/e440/t441 7/94 1 general description 1.1 introduction st52x400/440/441 are 8-bit intelligent control units (icu) of the st five family, which are able to perform both boolean and fuzzy algorithms in an efficient manner, in order to reach the best per- formances that the two methodologies allow. st52x400/440/441 is produced by stmicroelec- tronics using the reliable high performance cmos process, including integrated-on-chip peripherals that allow maximization of system reliability, decreasing system costs and minimizing the number of external components. the flexible i/o configuration of st52x400/440/ 441 allows for an interface with a wide range of external devices, like d/a converters or power control devices. st52x400/440/441 pins are configurable, allowing the user to set the input or output signals on each single pin. a hardware multiplier (8 bit by 8 bit with 16 bit result) and divider (16 bit over 8 bit with 8 bit result and 8 bit remainder) is available to imple- ment complex functions by using a single instruc- tion, optimizing program memory utilization and computational speed. fuzzy logic dedicated structures in st52x400/ 440/441 icus can be exploited to model complex sys tems with high accuracy in a useful and easy way. fuzzy expert systems for overall system manage- ment and fuzzy real time controls can be designed to increase performances at highly com- petitive costs. the linguistic approach characterizing fuzzy logic is based on a set of if-then rules, which describe the control behavior, as well as on mem- bership functions, which are associated to input and output variables. up to 334 membership functions, with triangular and trapezoidal shapes, or singleton values are available to describe fuzzy variables. the timer/pwm peripheral allows the manage- ment of power devices and timing signals, imple- menting different operating modes and high frequency pwm (pulse with modulation) controls. input capture and output compare functions are available on the timer. the programmable timer has a 16 bit internal prescaler and an 8 bit counter. it can use internal or external start/stop signals and clock. an internal programmable watchdog is avail- able to avoid loop errors and to reset the icu. an analog comparator with a 6 channel multi- plexer is available on st52x440/441 family devices. this analog peripheral allows easy imple- mentation of a high resolution a/d conversion. by using only an external capacitor this peripheral may be configured in order to achieve up to 12 bit a/d converter resolution. it includes a 2.5 v band- gap reference for a/d conversion calibration, which can be used externally for signal condition- ing. an on-chip triac driver peripheral allows the direct management of power devices, implement- ing two different operating modes: burst mode (i.e. thermal applications), phase angle partial- ization (i.e. motors control by triacs). the triac driver also generates a pwm signal. the st52x400/440/441 family also includes an on-chip power-on-reset (por), which provides an internal chip reset during power up situation and a brown-out detector (bod), which resets the icu if the voltage source v dd dips below a minimum value. in order to optimize energy consumption, two dif- ferent power saving modes are available: wait mode and halt mode. program memory (eprom/otp) addressing capability addresses up to 8 kbytes of memory locations to store both program instructions and permanent data. eprom can be locked by the user to prevent external undesired operations. operations may be performed on data stored in ram, allowing the direct combination of new input and feedback data. all bytes of ram are used like register file. otp (one time programmable) version devices are fully compatible with the eprom windowed version, which may be used for prototyping and pre-production phases of development. a powerful development environment consisting of a board and software tools allows an easy con- figuration and use of st52x400/440/441. the visual five tm software tool allows devel- opment of projects through a user-friendly graphi- cal interface and optimization of generated code.
st52t400/t440/e440/t441 8/94 1.2 operational description st52x400/440/441 icu can work in two modes: n memory programming phase n working phase according to reset and vpp signals levels (see pins description) . note: when reset=0 it is advisable not to use the sequence 101010 to port pa ( 7 : 2 ). 1.2.1 memory programming phase. the st52x400/440/441 memory is loaded in the memory programming phase. all fuzzy and stan- dard instructions are written inside the memory. this phase starts by setting the control signals as illustrated in (see table 1.1). when this phase starts, the st52x400/440/441 core is set to reset status; then 12v are applied to the vpp pin in order to start eprom programming. a signal applied to pb1 is used to increment the memory address; the data is sup- plied to port a (see eprom programming for further details). 1.2.2 working mode. the processor starts the working phase following the instructions, which have been previously loaded in the memory. st52x400/440/441s internal structure includes a computational block, control unit (cu)/data processing unit (dpu), which allows pro- cessing of boolean functions and fuzzy algo- rithms. the cu/dpu can manage up to 334 different membership functions for the fuzzy rules ante- cedent part. the rule consequents are crisp val- ues (real numbers). the maximum number of rules that can be defined is limited by the dimen- sions of the implemented standard algorithm. eprom is then shared between fuzzy and stan- dard algorithms. the membership function data is stored inside the first 1024 memory locations. the fuzzy rules are parts of the program instructions. the control unit (cu) reads the information and the status deriving from the peripherals. arithmetic calculus can be performed on these values by using the internal cu and the 128/256 bytes of ram, which supports all computations. the peripheral input can be fuzzy and/or arith- metic output, or the values contained in data ram and eprom locations. table 1.1 control signals setting control signal pro- gramming reset working reset 0 0 1 vpp 5v /12v 0 0
st52t400/t440/e440/t441 9/94 figure 1.1 st52x400/440/441 block diagram analog comparator user program eprom 8 kbytes timer/pwm triac dr i v e r i/o port control unit reset oscout oscin vss vdd alu & decision processor pc cu input registers vpp int 256 bytes ram watchdog tres t c l k t ou t t s trt m a in1 m a in2 t r ou t t ou t n power supply and bod oscillator p o w e ro n rese t (*) (*) only in st52x440 devices
st52t400/t440/e440/t441 10/94 figure 1.2 st52x400 so28 pin configuration vdd vss pb7 pa0/trout pa1/main1 pa2/main2/toutn pa3 28 27 25 24 23 22 21 20 19 1 2 3 7 4 5 6 8 9 10 26 pa4/tstrt pa5/tclk pa6/tres/tout vss pb3 pb2 pb1 pb0 oscin oscout reset pa7/int pb6 pb5 pb4 18 17 11 12 16 15 13 14 pc0 pc1 pc3 vpp pc4 pc2 figure 1.3 st52x400 pdip28 pin configuration 28 27 25 24 23 22 21 20 19 1 2 3 7 4 5 6 8 9 10 26 18 17 11 12 16 15 13 14 vdd vss pa0/trout pa1/main1 pa2/main2/toutn pa3 pa4/tstrt pa5/tclk pa6/tres/tout reset pa7/int pc0 pc1 pc2 pb7 vss pb3 pb2 pb1 pb0 oscin oscout pb6 pb5 pb4 pc3 vpp pc4
st52t400/t440/e440/t441 11/94 figure 1.4 st52x400 so20 pin configuration figure 1.5 st52x400 pdip20 pin configuration
st52t400/t440/e440/t441 12/94 figure 1.6 st52x440/441 so28 pin configuration vdd vss pb7/cs pa0/trout pa1/main1 pa2/main2/toutn pa3/acstrt 28 27 25 24 23 22 21 20 19 1 2 3 7 4 5 6 8 9 10 26 pa4/tstrt pa5/tclk pa6/tres/tout gnda pb3/ac3 pb2/ac2 pb1/ac1 pb0/ac0 oscin oscout reset pa7/int/acsync pb6/bg pb5/ac5 pb4/ac4 18 17 11 12 16 15 13 14 pc0 pc1 pc3 vpp pc4 pc2 figure 1.7 st52x440/441 pdip28 pin configuration 28 27 25 24 23 22 21 20 19 1 2 3 7 4 5 6 8 9 10 26 18 17 11 12 16 15 13 14 vdd vss pa0/trout pa1/main1 pa2/main2/toutn pa3/acstrt pa4/tstrt pa5/tclk pa6/tres/tout reset pa7/int/acsync pc0 pc1 pc2 pb7/cs gnda pb3/ac3 pb2/ac2 pb1/ac1 pb0/ac0 oscin oscout pb6/bg pb5/ac5 pb4/ac4 pc3 vpp pc4
st52t400/t440/e440/t441 13/94 figure 1.8 st52x440/441 so20 pin configuration figure 1.9 st52x440/441 pdip20 pin configuration
st52t400/t440/e440/t441 14/94 table 1.2 so28 and dip28 pin configuration - st52x400 pin so28/dip28 name programming phase working phase 1 oscout oscillator output 2 oscin oscillator input 3 vpp eprom programming power supply (12v 5%) eprom v dd or vss 4 pc4 digital i/o 5 pc3 digital i/o 6 pb7 phase signal (phase) digital i/o 7 pb6 digital i/o 8 pb5 digital i/o 9 pb4 digital i/o 10 pb3 configuration increment (inc_conf) digital i/o 11 pb2 configuration reset (rst_conf) digital i/o 12 pb1 address increment (inc_add) digital i/o 13 pb0 address reset (rst_add) digital i/o 14 vss this pin must be tied to digital ground 15 pa0/trout i/o eprom data digital i/o - triac driver output 16 pa1/main1 i/o eprom data digital i/o zero crossing detection pin 1 17 pa2/main2/ toutn i/o eprom data digital i/o zero crossing detection pin 2 complementary timer output 18 pa3 i/o eprom data digital i/o 19 pa4/tstrt i/o eprom data digital i/o - timer external start 20 pa5/tclk i/o eprom data digital i/o - timer external clock 21 pa6/tres/tout i/o eprom data digital i/o timer external reset - timer output 22 pa7/int i/o eprom data digital i/o external interrupt 23 pc2 digital i/o 24 pc1 digital i/o 25 pc0 digital i/o 26 reset general reset general reset 27 v ss digital ground digital ground 28 v dd digital power supply digital power supply
st52t400/t440/e440/t441 15/94 table 1.3 so20 and dip20 pin configuration - st52x400 pin so20/dip20 name programming phase working phase 1v dd digital power supply digital power supply 2 oscout oscillator output 3 oscin oscillator input 4 vpp eprom programming power supply (12v 5%) eprom v dd or vss 5 pb7 phase signal (phase) digital i/o 6 pb3 configuration increment (inc_conf) digital i/o 7 pb2 configuration reset (rst_conf) digital i/o 8 pb1 address increment (inc_add) digital i/o 9 pb0 address reset (rst_add) digital i/o 10 vss this pin must be tied to digital ground 11 pa0/trout i/o eprom data digital i/o - triac driver output 12 pa1/main1 i/o eprom data digital i/o zero crossing detection pin 1 13 pa2/main2/ toutn i/o eprom data digital i/o zero crossing detection pin 2 complementary timer output 14 pa3 i/o eprom data digital i/o 15 pa4/tstrt i/o eprom data digital i/o - timer external start 16 pa5/tclk i/o eprom data digital i/o - timer external clock 17 pa6/tres/tout i/o eprom data digital i/o timer external reset - timer output 18 pa7/int i/o eprom data digital i/o external interrupt 19 reset general reset general reset 20 v ss digital ground digital ground
st52t400/t440/e440/t441 16/94 table 1.4 so28 and dip28 pin configuration - st52x440/441 pin so28/dip28 name programming phase working phase 1 oscout oscillator output 2 oscin oscillator input 3 vpp eprom programming power supply (12v 5%) eprom v dd or vss 4 pc4 digital i/o 5 pc3 digital i/o 6 pb7/cs phase signal (phase) digital i/o - capacitor connection 7 pb6/bg digital i/o - bandgap reference 8 pb5/ac5 digital i/o analog comparator channel 5 9 pb4/ac4 digital i/o analog comparator channel 4 10 pb3/ac3 configuration increment (inc_conf) digital i/o analog comparator channel 3 11 pb2/ac2 configuration reset (rst_conf) digital i/o analog comparator channel 2 12 pb1/ac1 address increment (inc_add) digital i/o analog comparator channel 1 13 pb0/ac0 address reset (rst_add) digital i/o analog comparator channel 0 14 gnda analog ground analog ground 15 pa0/trout i/o eprom data digital i/o - triac driver output 16 pa1/main1 i/o eprom data digital i/o zero crossing detection pin 1 17 pa2/main2/ toutn i/o eprom data digital i/o zero crossing detection pin 2 18 pa3/acstrt i/o eprom data digital i/o analog comp. counter external start 19 pa4/tstrt i/o eprom data digital i/o - timer external start 20 pa5/tclk i/o eprom data digital i/o - timer external clock 21 pa6/tres/tout i/o eprom data digital i/o timer external reset - timer output 22 pa7/int/ acsync i/o eprom data digital i/o - external interrupt analog comparator counter ready 23 pc2 digital i/o 24 pc1 digital i/o 25 pc0 digital i/o 26 reset general reset general reset 27 v ss digital ground digital ground 28 v dd digital power supply digital power supply
st52t400/t440/e440/t441 17/94 table 1.5 so20 and dip20 pin configuration - st52x440/441 pin so20/dip20 name programming phase working phase 1v dd digital power supply digital power supply 2 oscout oscillator output 3 oscin oscillator input 4 vpp eprom programming power supply (12v 5%) eprom v dd or vss 5 pb7/cs phase signal (phase) digital i/o - capacitor connection 6 pb3/ac3 configuration increment (inc_conf) digital i/o analog comparator channel 3 7 pb2/ac2 configuration reset (rst_conf) digital i/o analog comparator channel 2 8 pb1/ac1 address increment (inc_add) digital i/o analog comparator channel 1 9 pb0/ac0 address reset (rst_add) digital i/o analog comparator channel 0 10 gnda analog ground analog ground 11 pa0/trout i/o eprom data digital i/o - triac driver output 12 pa1/main1 i/o eprom data digital i/o zero crossing detection pin 1 13 pa2/main2/ toutn i/o eprom data digital i/o zero crossing detection pin 2 complementary timer output 14 pa3/acstrt i/o eprom data digital i/o analog comp. counter external start 15 pa4/tstrt i/o eprom data digital i/o - timer external start 16 pa5/tclk i/o eprom data digital i/o - timer external clock 17 pa6/tres/tout i/o eprom data digital i/o timer external reset - timer output 18 pa7/int/ acsync i/o eprom data digital i/o - external interrupt analog comparator counter ready 19 reset general reset general reset 20 v ss digital ground digital ground
st52t400/t440/e440/t441 18/94 1.3 pin description st52x400/440/441 pins can be set in digital input mode, digital output mode or in alternate func- tions. the pin configuration is achieved by means of the configuration registers. the functions of the st52x400/440/441 pins are described below: v dd. main power supply voltage (5v 10%). v ss . digital circuit ground. all vss pins must be connected to ground (see st52t400 pin-out). gnda . analog circuit ground of the analog com- parator. must be tied to v ss . v pp . main power supply for internal eprom pro- gramming and mode selector. during the pro- gramming phase v pp must be set at 12v. in the working phase v pp must be equal to v ss . oscin and oscout. these pins are internally connected to the on-chip oscillator circuit. a quartz crystal or a ceramic resonator can be connected between these two pins in order to allow the cor- rect operations of st52x400/440/441 with various stability/cost trade-offs. an external clock signal canbeappliedtooscin:inthiscaseoscout must be grounded. reset . this signal is used to reset the st52x400/440/441 and re-initialize the registers and control signals. it also allows the user to select the working mode of the device. pa0-pa7, pb0-pb7,pc0-pc4 . these lines are organized as i/o ports. each pin can be config- ured as an input or output. during the program- ming phase the ports are used for eprom data read/write operations. ac0-ac5(*) . these pins are used to input the analog signals to the analog comparator. an ana- log multiplexer is available to switch these inputs to the analog comparator. cs(*) . this pin outputs the current generated in the analog comparator peripheral by a current generator, allowing charging of an external capac- itor to obtain a voltage ramp for the a/d conver- sion. acstrt, acsync(*) . these pins are used to synchronize the 16-bit counter of the analog com- parator with an external ramp generator. the acstrt input is used to start the counter. the acsync output is set when the counter is ready to start a new count. bg(*) . a bandgap reference value of 2.5v is available on this pin. it can be used for analog sig- nal conditioning. tout, toutn .these pins output the signal gen- erated by the timer peripheral. the t0outn signal is the complement of the t0out one. tres , tstrt, tclk . these pins are related to the timer peripheral and are used for input cap- ture and event counting. the tres pin is used to set/reset the timer; the tstrt pin is used to start/ stop the counter. the timer can be driven by the internal clock or by an external signal connected to the tclk pin. trout, main1, main2 . these pins are related to the triac driver peripheral. trout outputs the signal generated by the peripheral. in order to drive a triac directly without the use of addi- tional components, the trout pin can supply up to 50 ma (2v voltage drop). main1 and main2 pins are used to detect the zero crossing of the power line voltage. (*) not available in st52x400 devices
st52t400/t440/e440/t441 19/94 2 internal architecture st52x400/440/441 is composed of the following blocks and peripherals: n control unit (cu) n data processing unit (dpu) n alu n decision processor (dp) n eprom n 256 byte ram n clock oscillator n analog multiplexer and analog comparator n 1pwm/timer n 1 triac/pwm driver n digital i/o port 2.1 control unit and data processing unit the control unit (cu) formally includes five main blocks. each block decodes a set of instructions, generating the appropriate control signals. the mainpartsofthecuareshowninfigure2.1. the five different parts of the cu manage load- ing, logic/arithmetic, jump, control and decision processor (dp) instructions sets. the block called collector manages the signals deriving from the different parts of the cu then defines the signals for the data processing unit (dpu) and for the different peripherals of the icu. the block called arbiter manages the different parts of the cu in order to have only one part of the system activated during working mode. the cu structure is highly flexible, designed with the objective of easily adapting the core of the microcontroller to market needs. new instructions sets or new peripherals can be easily included without changing the structure of the microcontrol- ler, maintaining code compatibility. the cu reads and decodifies the instructions stored on the eprom (fetch). according to the instructions type, the arbiter activates one of the main blocks of the cu. afterwards, all the control signals for the dpu are generated. a set of 55 different arithmetic, dp and logic instructions is available. the arithmetic instruc- tions operate to all the ram addresses without the need of using special registers. the dpu receives, stores and sends the instruc- tions coming from the eprom, ram or from the peripherals in order to execute them. 2.1.1 program counter. the program counter (pc) is a 13-bit register that contains the address of the next memory location to be processed by the core. this memory loca- tion may be an opcode, an operand or an address of an operand. figure 2.1 cu block diagram loading instruction set logic arithmetic instruction set jump instruction set control instruction set decision processor instruction set c o l l e c t o r cont r ol s i g n a l s a r b i t e r microcode clock master
st52t400/t440/e440/t441 20/94 figure 2.2 data processing unit (dpu) m u x program counter ram 128 bytes address ram stack point multiplexer accumulator registers a l u flags reg. a d d _ e p r per i ph e r a l s c u eprom inputs peripherals figure 2.3 cu/dpu block diagram e p r o m c u d p u ram to peripherals from p eripherals eprom address m icrocode ram addr. ram data8bit ram data out 8bit c o n tro l s ig n a ls 8bit
st52t400/t440/e440/t441 21/94 the 13-bit length allows the direct addressing of 8192 bytes in the program space: jump and call instruction support the absolute addressing in all the memory. after having read the current instruction address, the pc value is incremented. the result of this operation is shifted back into the pc. the pc can be changed in the following ways: n jp (jump) instruction pc = jump address n interrupt pc = interrupt vector n reti instruction pc = pop (stack) n reset pc = reset vector n normal instruction pc = pc + 1 2.1.2 flags. the st52x400/440/441 core includes different sets of flags that correspond to 2 different modes: normal mode and interrupt mode. each set of flags consist of a carry flag (c), zero flag (z) and sign flag (s). one set of flags (cn, zn, sn) is used during normal operation and one is used during interrupt mode (ci, zi, si). formally, the user has to manage only one set of flags: c, z and s. the st52x400/440/441 core uses the flags that correspond to the actual mode: as soon as an interrupt is generated, the st five core uses the interrupt flags instead of the normal flags. each interrupt level has its own set of flags, which is saved in the flag stack during interrupt servic- ing. these flags are restored from the flag stack auto- matically when a reti instruction is executed. if the icu was in the normal mode before an inter- rupt, after the reti instruction is executed, the normal flags are restored. note: a call subroutine is a normal mode exe- cution. for this reason a ret instruction, conse- quent to a call instruction, doesnt affect the normal mode set of flags. flags are not cleared during context switching and remain in the state they were located in at the end of the last interrupt routine switching. the carry flag is set when an overflow occurs dur- ing arithmetic operations, otherwise it is cleared. the sign flag is set when an underflow occurs during arithmetic operations, otherwise it is cleared. 2.2 address spaces st52x400/440/441 has four separate address spaces: n ram: 128 or 256 bytes n 20 input registers n 6 output registers n 21 configuration registers n program memory: up to 8k bytes the program memory will be described in further details in the eprom section figure 2.4 address spaces description cu dpu alu p e r i p h e r a l bl o ck data ram input registers non volatile memory program memory st five core o nc h i p per i phe r a l s output r e gister c o n f i gur a ti o n r e g i s t e r s p e r i p h e r a l bl o ck p e r i p h e r a l bl o ck ldre ldri ldce l d c r dp registers ldfr ldpe l dp r program counter
st52t400/t440/e440/t441 22/94 2.2.1 ram and stack. ram consists of 128 (g0/g1/f0/f1 types) or 256 (g2/g3/f2/f3 types) general purpose 8-bit regis- ters. all the registers in ram can be specified by using a decimal address, e.g. 0 identifies the first regis- ter of ram. to read or write in the ram registers, the load instructions must be used (see table 2.5). when the instructions like interrupt request or call are executed, a stack is used to push the pc. the stack is push directly in the ram. for each level of stack 2 bytes of ram are used. the values of this stack are stored from the last ram register (address 255). the maximum level of stack must be less than 128. when a subroutine call or interrupt request occurs, the contents of each level is shifted into the next level while the content of the pc is shifted into the first level. when a subroutine or interrupt return occurs (ret or reti instructions), the first level register is shifted back into the pc and the value of each level is popped back into the previous level. these operating modes are illustrated in figure 2.5. 2.2.2 input registers bench. the input registers (ir) bench consists of 20 8-bit registers containing data deriving from the periph- erals and parallel ports. all the registers can be specified by using a deci- mal address, e.g. 0 identifies the first register of the ir. the assembler instruction: ldri reg,inp_teg loads the value in the inp ir to the register (ram loca- tion) identified by the address reg. the first input register is dedicated to store the value of the stack pointer. the next 12 registers of the ir are dedicated to the 6 (for st52x440g/ 441g) or the 4 converted values (for st52x440f/ 441f) in case of converted values coming from the analog comparator (in st52x400 devices these registers are not used). each of these val- ues are stored on two bytes because of the reso- lution of the a/d conversion process. the last 7 registers contain data from the i/o ports and pwm/timers. table 2.1 summarizes the ir address and the relative peripheral. in order to simplify the concept a mnemonic name is assigned to the registers. the same name is used in visual five development tools. figure 2.5 stack operation program counter ram reg 0 reg 1 reg 2 reg 3 reg 4 reg 5 reg 255 reg 254 reg 253 reg 252 stack level 1 stack level 2 .......................... stack level n when call or interrupt req. when reti or ret occurs occurs stack pointer
st52t400/t440/e440/t441 23/94 2.2.3 configuration registers. the st52x400/440/441 configuration registers allow the configuration of all the blocks of the icu. table 2.2 describes the functions and the related peripherals of the 21 configuration registers available: in order to simplify the concept a mne- monic name is assigned to each configuration register. the same name is used in visual five tm development tools. by using the load instructions the configuration registers may be set by using values stored in the program memory (eprom) or in the ram. the assembler instruction ldce conf,mem loads the configuration register conf with the contents of memory location mem , inside the currently set memory page. the assembler instructions ldcr conf,reg loads the configuration register conf with the contents of the register (ram location) reg . use and meaning of each register will be described in further details in the corresponding section. 2.2.4 output registers. the output registers (or) consist of 6 registers containing data for the icu peripherals including i/ oports. all registers can be specified by using a decimal address, e.g. 1 identifies the second or. by using the load type instructions the output registers (or) may be set with values stored in the program memory (ldpe) or in the ram (ldpr). the assembler instruction ldpe out,mem loads the output register out with the contents of mem- ory location mem , inside the currently set memory page. the assembler instruction ldpr out,reg loads the output register out with the contents of register (ram location) reg . table 2.3 describes the or: in order to simplify the concept a mnemonic name is assigned to each of the output registers. the same name is used in visual five tm development tools. use and meaning of each register will be described in fur- ther details in the corresponding section. table 2.1 input registers ir mnemonic name peripheral register address stack_pointer stack pointer 0 ac_chan0h(*) analog comparator channel 0 high byte 1 ac_chan0l(*) analog comparator channel 0 low byte 2 ac_chan1h(*) analog comparator channel 1 high byte 3 ac_chan1l(*) analog comparator channel 1 low byte 4 ac_chan2h(*) analog comparator channel 2 high byte 5 ac_chan2l(*) analog comparator channel 2 low byte 6 ac_chan3h(*) analog comparator channel 3 high byte 7 ac_chan3l(*) analog comparator channel 3 low byte 8 ac_chan4h (*)(**) analog comparator channel 4 high byte 9 ac_chan4l (*)(**) analog comparator channel 4 low byte 10 ac_chan5h (*)(**) analog comparator channel 5 high byte 11 ac_chan5l (*)(**) analog comparator channel 5 low byte 12 ac_status(*) analog comparator status register 13 port_a port a input register 14 port_b port b input register 15 port_c (**) port c input register 16 triac_count triac driver counter value 17 pwm_count pwm/timer counter value 18 pwm_status timer status register 19 (*) not used on st52x400xx versions (**) not used on st52x400f/440f441f versions
st52t400/t440/e440/t441 24/94 (*) not used on st52x400xx versions table 2.2 configuration registers description configuration register peripheral description reg_conf 0 interrupt mask interrupts mask setting, polarity, brown out reg_conf 1(*) analog comparator ac configuration register 1 reg_conf 2 watchdog timer watchdog timer configuration reg_conf 3(*) analog comparator ac configuration register 2 reg_conf 4 port a port a digital pin i/o direction reg_conf 5 pwm/timer pwm/timer working mode configuration reg_conf 6 pwm/timer pwm/timer prescaler configuration and output waveform selection. reg_conf 7 pwm/timer pwm/timer prescaler settings reg_conf 8 pwm/triac pwm/triac prescaler settings reg_conf 9 pwm/triac pwm/triac prescaler configuration and output waveform selection. reg_conf 10 pwm/triac pwm/triac working mode configuration reg_conf 11 port c port c digital pin i/o direction reg_conf 12 port a port a alternate function settings reg_conf 13 port b port b digital pin i/o direction reg_conf 14(*) port b port b settings for digital or analog pin reg_conf 15(*) analog comparator analog comparator prescaler settings reg_conf 16(*) analog comparator analog comparator in a/d working mode reg_conf 17 interrupt interrupt priorities reg_conf 18 interrupt interrupt priorities reg_conf 19 triac triac pulses width configuration reg_conf 20 triac triac pulses width configuration table 2.3 output registers or mnemonic name peripheral register address port_a port a output register 0 port_b port b output register 1 port_c (**) port c output register 2 pwm_count timer/pwm counter value 3 pwm_reload (*) pwm/timer reload value 4 not used 5 not used 6 not used 7 not used 8 triac_count triac driver counter value 9 ( *) used if peripheral has been programmed in pwm mode (**) not used on st52x400f/440f/441f versions
st52t400/t440/e440/t441 25/94 2.3 fuzzy computation st fives fuzzy main features are: n up to 8 inputs with 8-bit resolution; n 1 kbyte of program/data memory available to store more than 300 to membership functions (mbfs) for each input; n up to 128 outputs with 8-bit resolution; n possibility to process fuzzy rules with an unlimited number of antecedents n unlimited number of rules and fuzzy blocks. the limits on the number of fuzzy rules and fuzzy blocks are only related to the program mem- ory size. 2.3.1 fuzzy inference . the block diagram illustrated in figure 2.7 describes the different steps performed during a fuzzy algorithm. the st five core allows the implementation of a mamdani type fuzzy infer- ence with crisp consequents. inputs for fuzzy inference are stored in 8 dedicated fuzzy input registers. the instruction ldfr is used to set the input fuzzy registers with values stored in the reg- ister file. the result of a fuzzy inference is stored directly in a location of the register file. 2.3.2 fuzzyfication phase. in this phase the intersection (alpha weight) between the input values and the related mbfs is performed (figure 2.6). 8 fuzzy input registers are available for fuzzy inferences. after loading the input values by using the ldfr assembler instruction, the user can start fuzzyn- ference by using the assembler instructionfuzzy. during fuzzyfication: input data is transformed in the activation level (alpha weight) of the mbfs. i figure 2.6 alpha weight calculation 1 input value a ij j-th mbf i-th input variable figure 2.7 fuzzy inference 11 1m n1 nm fuzzyfication inference phase defuzzyfication nrules n rules -1 2 1 input values output values
st52t400/t440/e440/t441 26/94 2.3.3 inference phase. the inference phase manages the alpha weights obtained during the fuzzyfication phase to com- pute the truth value ( w ) for each rule. this is a calculation of the maximum (for the or operator) and/or minimum (for the and operator) performed on alpha values according to the logical connectives of fuzzy rules. several conditions may be linked together by lin- guistic connectives and/or, not operator and brackets. the truth value w and the related output singleton- move to the defuzzyfication phase in order to complete the inference calculation. 2.3.4 defuzzyfication. in this phase the output crisp values are deter- mined by implementing the consequent part of the rules. each consequent singleton x i is multiplied by its weight values w i , calculated by the fuzzy infer- ence unit, in order to compute the upper part of the defuzzification. each output value is deduced from the conse- quent crisp values (x i ) by carrying out the follow- ing defuzzification formula: where: i = 0,1 identifies the current output variable n = number of the active rules on the current out- put w ij =weight of the j-th singleton xij = abscissa of the j-th singleton fuzzy outputs are stored in the ram location i-th specified in the assembler instruction out i. figure 2.8 fuzzyfication input 1 x1 a 1 input 2 x2 a2 or = max if input 1 is x1 or input 2 is x2 then ....... input 1 x1 a 1 input 2 x2 a2 if input 1 is x1 and input 2 is x2 then ...... figure 2.9 output membership functions 1 i-th output 0 x ij x i0 x in w i0 w ij w in j-th singleton y i x ij w ij j n w ij j n ---------------------- =
st52t400/t440/e440/t441 27/94 2.3.5 input membership function. st five allows the management of triangular mbfs. in order to define an mbf, three different types of data must be stored on the program/data memory: the vertex of the mbf: v ; the length of the left semi-base: lvd ; the length of the right semi-base: rvd ; in order to reduce the size of the memory area and the computational effort the vertical dimension of the vertex is set to 15 (4 bits). by using the previous memorization method differ- ent kinds of triangular membership functions may be stored. figure 4.6 illustrates a typical example of mbfs that can be defined in st five. each mbf is then defined storing 3 bytes in the first 1 kbyte of the program memory. the mbf is memorized by using the following instruction: mbf n_mbf lvd v rvd where n_mbf identifies mbf, lvd, v, and rvd, which are the parameters that describe the mbfs shape. 2.3.6 output singleton. st five uses a particular kind of membership function called singleton for its output variables. a singleton doesnt have a shape, like a traditional mbf, and is characterized by a single point identi- fied by the couple (x, w), where the w is calcu- lated by the inference unit as described before. often, a singleton is simply identified with its crisp value x. 2.3.7 fuzzy rules. rules can have the following structures: if a op b op c...........then z if (a op b) op (c op d op e...)...........then z where op is one of the possible linguistic opera- tors (and/or) in the first case the rule operators are managed sequentially; in the second one, the priority of the operator is fixed by the brackets. each rule is codified by using an instruction set, the inference time for a rule with 4 antecedents and 1 consequent is about 3 microseconds. figure 2.10 mbfs parameters x 15 lvd rvd v 15 0 0 input mbf output singleton output variable input variable w figure 2.11 example of valid mbfs
st52t400/t440/e440/t441 28/94 the assembler instruction set, which manages fuzzy instructions is reported in the following table: table 2.4 fuzzy instruction set instruction description mbf n_mbf ivd v rvd stores the mbf n_mbf with the shape identified by the parameters ivd , v and rvd ldp nm fixes the alpha value of the input n with the mbf m and stores it in internal registers ldn nm calculates the complementary alpha value of the input n with the mbf m . and stores the result in internal registers fzand implements the fuzzy operation and between the last two values stored in internal registers fzor implements the fuzzy operation or between the last two values stored in internal regis- ters ldk stores the result of the last fuzzy operation executed in internal registers skm loads the result of the last performed fuzzy operation (stored in the temporary register k) in the temporary buffer m. ldm copies the value of register m in the data stack con crisp multiplies the crisp value with the last w weight out n_out performs defuzzyfication and stores the currently fuzzy output in the ram n_out location fuzzy starts the fuzzy algorithm
st52t400/t440/e440/t441 29/94 example 1 : if input 1 is not mbf 1 and input 4 is mbf 12 or input 3 is mbf 8 then crisp 1 is codified by the following instructions: ldn 1 1 calculates the not a value of input 1 with mbf 1 and stores the result in internal registers ldp 4 12 fixes the a value of input 4 with m 12 and stores the result in internal registers fzand adds the not a and a values obtained with the operations ldn1 1 and ldp 4 12 ldk stores the result of the operation fzand in internal registers ldp 3 8 fixes the a value of input 3 with mbf 8 and stores the result in internal registers fzor implements the operation or between the results obtained with the operations ldk and ldp con crisp 1 multiplies the result of the last w operation with the crisp value crisp 1 example 2 , the priority of the operator is fixed by the brackets: if (input 3 is mbf 1 and input 4 is not mbf 15 )or(input 1 is mbf 6 or input 6 is not mbf 14 )thencrisp 2 ldp 3 fixes the a value of input3 with mbf1 and stores the result in internal registers ldn 4 15 calculates the not a value of input 4 with mbf 15 and stores the result in internal registers fzand adds not a and a values obtained with the operations ldp 3 1 and ldn 4 15 skm stores the result of the operation fzand in internal registers ldp 1 6 fixes the a value of input 1 with mbf 6 and stores the result in internal registers ldn 2 14 calculates the not a value of input 6 with mbf 14 and stores the result in internal registers fzor implements the operation or between the a and not a values obtained with the two previ- ous operations (ldp 1 6 and ldn 2 14) ldk stores the result of the operation or in internal registers ldm copies the value of the memory register m in internal registers fzor implements the operation or between the last two values stored in internal registers (ldk and ldm) con crisp 2 multiplies the result of the last w operation with the crisp value crip 2 at the end of the fuzzy rule, by using the instruction out ram_reg, a byte is written. afterwards, the con- trol of the algorithm goes returns to the cu.
st52t400/t440/e440/t441 30/94 2.4 arithmetic logic unit st52x400/440/441 supplies 46 instructions that perform computations and control the device. computational time required for each instruction consists of one clock pulse for each cycle plus 2 clock pulses for the decoding phase. total compu- tation time for each instruction is reported in table 2.5 the alu of the st52x400/440/441 can perform multiplication (mult) and division (div). multipli- cation is performed by using 8 bit operands stor- ing the result in 2 registers (16 bit values). division is performed between a 16 bit dividend and an 8 bit divider, the result and the remainder are stored in two 8-bit registers. warning: if the lsb of the multiplication result is 0, the zero flag is set although the result is not 0. 2.4.1 addressing modes. st52x400/440/441 instructions allow the following addressing modes: inherent: this instruction type does not require an operand because the opcode specifies all the information necessary to carry out the instruction. examples: nop, ret. immediate: these instructions have an operand as a source immediate value. examples: ldrc, pgset. direct: the operands of these instructions are specified with the direct addresses. the operands can refer, according to the opcode, to addresses belonging to the different addressing spaces. example: sub, ldre. indirect: data addresses that are required are found in the locations specified as operands. both source and/or destination operands can be addressed indirectly. the operands can refer, (according to the opcode) to addresses belonging to different addressing spaces. examples: ldre (reg1),(reg2). 2.4.2 instruction types. st five supplies the following instruction types: n load instructions n arithmetic and logic instructions n jump instructions n interrupt management instructions n control instructions the instructions are listed in table 2.5, table 2.6 and table 2.7. table 2.5 arithmetic & logic instruction set load instructions mnemonic instruction bytes cycles z s c ldce ldce confx,memx 3 17 - - - ldcr ldrc confx,regx 3 14 - - - ldfr ldfr fuzzyx,regx 3 14 - - - ldpe ldpe outx,memx 3 17 - - - ldpe ldpe outx,(regx) 3 17 - - - ldpr ldpr outx,regx 3 14 - - - ldrc ldrc regx,const 3 14 - - - ldre ldre regx,memx 3 16 - - - ldre ldre (regx),(regy) 3 18 - - - ldri ldri regx,inpx 3 15 - - - ldrr ldrr regx, regy 3 16 - - - pgset pgset const 2 9 - - -
st52t400/t440/e440/t441 31/94 table 2.6 arithmetic and logic instruction set (continued) arithmetic instructions mnemonic instruction bytes cycles z s c add add regx, regy 3 17 i - i addo addo regx, regy 3 20 i i i and and regx, regy 3 17 i - - asl asl regx 2 15 i - i asr asr regx 2 15 i i - dec dec regx 2 15 i i - div div regx, regy 3 26 i i i inc inc regx 2 15 i - i mult mult regx, regy 3 19 i - - not not regx 2 15 i - - or or regx, regy 3 17 i - - sub sub regx, regy 3 17 i i - subo subo regx, regy 3 20 i i i mirror mirror regx 2 15 i - - jump instructions mnemonic instruction bytes cycles z s c call call addr 3 18 - - - jp jp addr 3 12 - - - jpc jpc addr 3 10/12 - - - jpnc jpnc addr 3 10/12 - - - jpns jpns addr 3 10/12 - - - jpnz jpnz addr 3 10/12 - - - jps jps addr 3 10/12 - - - jpz jpz addr 3 10/12 - - - ret ret 1 13 - - - interrupt instructions set mnemonic instruction bytes cycles z s c halt halt 1 7/15 - - - megi megi 1 7/15 - - - mdgi mdgi 1 6 - - - reti reti 1 12 - - - rint rint const 2 8 - - - udgi udgi 1 6 - - - uegi uegi 1 7/15 - - - waiti waiti 1 7/14 - - -
st52t400/t440/e440/t441 32/94 notes : | flag affected - flag not affected regx, regy: register file addresses memx, memy: program/data memory addresses confx, confy: configuration registers addresses outx: output registers addresses inpx: input registers addresses const: constant value fuzzyx: fuzzy input register addr: program instructions address table 2.7 control instructions set control instructions set mnemonic instruction bytes cycles z s c fuzzy fuzzy 1 5 - - - nop nop 1 6 - - - wdtrfr wdtrfr 1 7 - - - wdtslp wdtslp 1 6 - - - figure 2.12 multiplication ram 0 1 2 i j+1 j-1 j 255 253 254 reg. j reg. i lsb m sb x 16 bi t figure 2.13 division ram 0 1 2 i j+1 j-1 j 255 253 254 reg. j reg. j+1 remainder quotient reg. i : i-1 i+1
st52t400/t440/e440/t441 33/94 3 eprom programming eprom memory provides an on-chip user-pro- grammable non-volatile memory, which allows fast and reliable storage of user data. eprom memory can be locked by the user. in fact, a memory location, called lock cell, is devoted to lock the eprom and to prevent memory reading. a software identification code (max 64 bytes), called id code may also be writ- ten in order to distinguish which software version is stored in the memory. there are 64 kbits of memory space with an 8-bit internal parallelism (8 kbytes) addressed by a 13- bit bus. the data bus is of 8 bits. memory has a double supply: v pp is equal to 12v 5% in programming phase or to v ss during working phase. v dd is equal to 5v 10%. the st52x400/440/441 eprom memory is divided into three main blocks (see figure 3.1): ? interrupt vectors memory block (3 through 14) contains the addresses for the interrupt rou- tines. each address is composed of three bytes. ? mbfs setting memory block (15 through 1024) contains the coordinates of the vertexes of every mbf defined in the program. if this part of the memory is not used to store the mbfs set- ting, it can be use to store the instruction set on the user program. ? the program instruction set memory block (1024 through 8191) contains the instruction set of the user program. table 3.1 eprom control register operation register value stand by 0 memory reading / verify 1 memory unlock and lock status reading 2 memory writing 3 memory lock 4 id code writing 5 memory lock status reading / verify 9 id code reading / verify 10 figure 3.1 program memory organization reset vector interrupt vectors membership functions parameters program instructions and permanent data program instructions and permanent data 0000h 0015h 0400h 0003h 2000h
st52t400/t440/e440/t441 34/94 the locations 0, 1 and 2 contain the jump instruc- tion to the first code line. this instruction is auto- matically inserted by the assembler tool. the operations that can be performed on eprom dur- ing the programming phase are: stand by, mem- ory writing, reading and verify/margin mode, memory lock, idcode writing and verify. the operations above are managed by using the 4-bit eprom control register. the reading phase is executed with v pp =5v 5%, while the verify/ margin mode phase needs v pp = 12v 5%. the blank check must be a reading operation with v pp =5v 5%. table 3.1 illustrates the eprom control register codes used to select the operation. programming of the eprom control register is described below. 3.1 eprom programming phase procedure programming mode is selected by applying 12v 5% voltage or 5v 5% voltage to the v pp pin and setting the reset pin =vss if the v pp voltage is 5v 5% only reading may be performed. rst_add (pb0), inc_add (pb1), rst_conf (pb2), inc_conf (pb3) and phase (pb7) are the control signals applied during programming mode. the signals rst_add, rst_conf and phase are active on level, the others are active on rising edge. the signals rst_add and phase are active low, signal on rst_conf is active high. data in/out digital signals are transferred through thepinsofporta. the memory may be locked by means of the memory lock status flag, that is used to enable eprom operations. if memory lock status flag is 1 all eprom opera- tions are enabled, otherwise, it is only possible to read (and verify) the otp code and the memory lock status flag. only if eprom is not locked by means of lock cell (see paragraph eprom locking), may eprom operations be enabled, changing the memory lock status flag from 0 to 1. the signal rst_add (pb0) resets the memory address register and the memory lock status flag. therefore, when the rst_add becomes high, the memory must be unlocked in order to read or write. the signal rst_conf (pb2) resets the eprom, figure 3.2 eprom programming timing memory unlock memory writing location address =1 data in mem o r y v e r i f y m a r g i n mod e data out d a t a data d a t a d at a o ut data out 100ns 10 m s pa(0:7) rst_add rst_conf inc_add inc_conf phase
st52t400/t440/e440/t441 35/94 inc_add (pb1) signal increments the memory address.control register. when rst_conf is high, the data i/o port a is in output, other- wise it is always in input. the signal applied on inc_conf (pb3) incre- ments the eprom control register value. to select the operation it must be provided as many signal edges as the value to be written in the reg- ister (see table 3.1). the signal on phase (pb7) validates the opera- tion selected by means of the eprom control register value. 3.1.1 eprom operation. in order to execute an eprom operation (see table 3.1), the corre- sponding identification value must be loaded in the eprom control register. the signal timing is the following: rst_add= high and phase= high, rst_conf changes from low to high level, to reset the eprom control register, and inc_conf signal generates a number of positive pulses equal to the value to be loaded. after this sequence, a negative pulse of the phase signal will validate the selected operation. the minimum phase signal pulse width must be 10 m sforthe eprom writing operation and 100 ns for the oth- ers. when rst_conf is high, the data i/o port a is enabled in output and the reading/verify operation results are available. after a writing operation, when rst_conf is high, port a is in output without valid data. 3.1.2 eprom locking. the memory lock oper- ation, which is identified with the number 4 in the eprom control register, writes 0" in the mem- ory lock cell. at the beginning of an external operation, when rst_add signal changes from low level to high level, the memory lock status flag is 0", therefore it is necessary to unlock it before proceeding. in order to unlock the memory lock status flag the operation, which is identified with the number 2 in the eprom control register must be executed (see figure 3.2). the memory lock status flag can be changed. therefore, after a memory lock operation, exter- nal operations cannot be executed except reading (or verify) the otp code and the memory lock status. 3.1.3 eprom writing. when the memory is blank, all the bits are at logic level 1". the data is introduced by programming only the zeros in the desired memory location; however, all input data must contain both 1 and 0". the only way to change 0" into 1 is to erase the whole memory (by exposure to uv light) and reprogram it. the memory is in writing mode when the eprom control register value is 3. the v pp voltage must be 12v 5%, with stable data on the data bus pb(0:7). the signals timing is the following (see figure 3.2): 1) rst_add and rst_conf change from low to high level, 2) two pulses on inc_conf signal load the mem- ory unlock operation code, 3) a negative pulse (100 ns) on the phase signal validates the memory unlock operation, 4) a negative pulse on rst_conf signal resets the eprom control register, 5) three positive pulses on inc_conf load the memory writing operation code, 6) a train of positive pulses on inc_add signal increments the memory location address up to the requested value (generally this is a sequential operation and only one pulse is used), 7) a negative pulse (10 m s) on the phase signal validates the memory writing operation. 3.1.4 eprom reading/verify margin mode. thereadingphaseisexecutedwithv pp =5v 5%, instead of verify phase that needs v pp =12v 5%. the memory verify operation is available in order to verify the correctness of the data written. the memory verify margin mode operation may be executed immediately after the writing of each byte and in this case (see figure 3.2): 1) one positive pulse on rst_conf signal resets the control register, if it was not already reset 2) one positive pulse on inc_conf loads the memory reading/verify operation code, 3) one negative pulse (100 ns) on the phase sig- nal validates the memory reading/verify opera- tion, 4) a negative pulse on rst_conf signal puts in the pb(0:7) port the value stored in the actual memory address and resets the eprom control register. then, if any error in writing occurred, the user has to repeat the eprom writing.
st52t400/t440/e440/t441 36/94 3.1.5 stand by mode. eprom has a standby mode which reduces the active current from 10ma (programming mode) to less than 100 m a. mem- ory is placed in standby mode by setting phase signal at high level or when the eprom control register value is 0 and phase signal is low. 3.1.6 id code. a software identification code, called id code may be written to distinguish which software version is stored in the memory. 64 bytes are dedicated to store this code by using the address values from 0 to 63. the id code may be read or verified even if the memory lock status is 0". the signals timing is the same as that of a normal operation. 3.2 eprom erasure thanks to the transparent window available in the cdip28w package, its memory contents may be erased by exposure to uv light. erasure begins when the device is exposed to light with a wavelength shorter than 4000?. it should be noted that sunlight, as well as some types of artificial light, includes wavelengths in the 3000-4000? range which, on prolonged exposure, can cause erasure of memory contents. it is thus recommended that eprom devices be fitted with an opaque label over the window area in order to prevent unintentional erasure. the recommended erasure procedure for eprom devices consists of exposure to short wave uv light having a wavelength of 2537?. the minimum recommended integrated dose (intensity x expo- sure time) for complete erasure is 15wsec/cm 2 . this is equivalent to an erasure time of 5-10 min- utes using a uv source having an intensity of 12mw/cm 2 at a distance of 25mm (1 inch) from the device window.
st52t400/t440/e440/t441 37/94 4 interrupts the control unit (cu) responds to peripheral events and external events via its interrupt chan- nels. when such an events occur, if the related interrupt is not masked and according to a priority order, the current program execution can be suspended to allow the cu to execute a specific response routine. each interrupt is associated with an interrupt vec- tor that contains the memory address of the related interrupt service routine. each vector is located in the program space (eprom memory) at a fixed address (see interrupt vectors figure 4.2). 4.1 interrupt operation if there are pending interrupts at the end of an arithmetic or logic instruction, the one with the highest priority is passed. passing an interrupt means to store the arithmetic flags and the current pc in the stack and execute the associated inter- rupt routine, whose address is located in three bytes of the eprom memory location between address 3 and 20. the interrupt routine is performed as a normal code checking, at the end of each instruction, if a higher priority interrupt has to be passed. an inter- rupt request with the higher priority stops the lower priority interrupt. the program counter and the arithmetic flags are stored in the stack. with the instruction reti (return from interrupt) the arithmetic flags and program counter (pc) are restored from the top of the stack, which was pre- viously described in section 2.2.1. an interrupt request cannot stop fuzzy rule pro- cessing, but this is passed only after the end of a fuzzy rule or at the end of a logic, or arithmetic instruction. remark: a fuzzy routine can be interrupted only in the main program. when a fuzzy function is running inside another interrupt routine an inter- rupt request can cause side effects in the control unit. for this reason, in order to use a fuzzy func- tion inside an interrupt routine, the user must include the fuzzy function between an udgi (mdgi) instruction and and uegi (megi) instruc- tion (see the following paragraphs), in order to dis- able the interrupt request during the execution of the fuzzy function. figure 4.1 interrupt flow figure 4.2 interrupt vectors mapping figure 4.3 global interrupt request generation int_ac int_triac/r 3 4 5 6 7 8 9 10 11 12 13 14 interrupt vectors in t _ t r i a c /f i nt_timer / p wm i n t _ e x t 1 5 1 6 1 7 1 8 1 9 2 0 in t _ t r ia c /p r ese t 0 1 2 normal program flow i n te r r upt s ervi c e r outine reti ins t ruct i o n interrupt global interrupt pending user global interrupt mask macro global global interrupt request
st52t400/t440/e440/t441 38/94 4.2 global interrupt request enabling when an interrupt occurs, it generates a global interrupt pending (gip), which can be masked by software. after a gip, a global interrupt request (gir) will be generated and an interrupt service routine associated to the interrupt with higher pri- ority will start. in order to avoid possible conflicts between interrupt masking set in the main pro- gram, or inside macros, the gip is masked through the user global interrupt mask or the macro global interrupt mask (see figure 4.3). uegi/udgi instruction switches the user global interrupt mask on/off, enabling/disabling the gir for the main program. megi/mdgi instructions switches the macro glo- bal interrupt mask on/off in order to ensure that the macro will not be broken. 4.3 interrupt sources st52x400/440/441 manages interrupt signals generated by the internal peripherals (pwm/ timer, triac driver and analog comparator) or deriving from the external interrupt on pin pa7. the external interrupt can be programmed to be active on the rising or falling edge of int/pa7 sig- nal by setting the pextint bit of the configura- tion register to 0. warning: changing the interrupt priority an interrupt request is generated. each peripheral can be programmed in order to generate the associated interrupt; further details are described in the related chapter.configuration register 0 is also used to enable/disable the brown-out (see the related chapter). 4.4 interrupt maskability the interrupts can be masked by configuring the configuration register 0 by means of an ldcr or an ldce instruction. the interrupt is enabled when the bit associated to the mask interrupt is 1". viceversa, when the bit is 0", the interrupt is masked and is kept pending. for example: ldrc 10,6 (loads the constant 6 in the ram register 10) ldcr 0,10 (sets reg_conf0 with the value stored in ram register 10) the result is reg_conf0=00000110, enabling the interrupts coming from the analog comparator (int_ac) and from the pwm/timer (int_pwm/ timer). reset configuration 00000000 table 4.1 configuration register 0 description bit name value description 0 mske 0 external interrupt masked 1 external interrupt not masked 1 mskac(*) 0 analog comparator interrupt masked 1 analog comparator interrupt not masked 2 msktm 0 pwm/timer interrupt masked 1 pwm/timer interrupt not masked 3 msktrf 0 triac falling edge interrupt 1 triac falling edge interrupt not masked 4 msktrr 0 triac rising edge interrupt masked 1 triac rising edge interrupt not masked 5 msktrp 0 triac pulse interrupt masked 1 triac pulse interrupt not masked 6 pextint 0 external interrupt active on rising edge 1 external interrupt active on falling edge 7 mskbr 0 brown-out disabled 1 brown-out enabled (*) not used in st52x400 devices
st52t400/t440/e440/t441 39/94 (*) used only in st52x440/441 devices table 4.2 interrupts description name description priority peripheral code mask- able vector addresses int_ac(*) analog comparator int programmable 000 yes 3-5 int_pwm/timer pwm/timer int programmable 001 yes 6-8 int_triac/f triac falling edge int programmable 010 yes 9-11 int_triac/r triac rising edge int programmable 011 yes 12-14 int_triac/p triac pulse int programmable 100 yes 15-17 int_ext external interrupt (int) ext highest - yes 18-20 figure 4.4 interrupt configuration register 0 reg_conf0 interrupts mask d7 d6 d5 d4 d3 d2 d1 d0 mske: ext. int. mskac: an. comp. int. msktm: timer int. msktrf: triac fall. int. msktrr: triac ris. int. pextint: ext. int. ris/fall. mskbr: brown out en. msktrp: triac pulse int.
st52t400/t440/e440/t441 40/94 4.5 interrupt priority seven priority levels are available: level 6 has the lowest priority, level 0 has the highest priority. level 6 is associated to the main program, levels 5 to 1 are programmable by means of the priority registers called reg_conf17 and reg_conf18; whereas the higher level is related to the external interrupt (int_ext). pwm/timer, triac/pwm and analog block are identified by a three-bit peripheral code (see table 4.2); in order to set the i -th priority level the user must write the peripheral label i in the related int i priority level. for instance: ldrc 10,193 (loads the value 193=11000001 in the ram register 10) ldrc 11,168 (loads the value 168=10101000 in the ram register 11) ldcr 17,10 (reg_conf17= 11000001) ldcr 18,11 (reg_conf18= 10101000) thus defining the following priority levels: n level 1: int_pwm/timer (pwm/timer code: 001) n level 2: int_adc (adc code: 000) n level 3: int_triac/pwm_r (triac/pwm code: 011) n level 4: int_triac/ph (triac/ph code: 100) n level 5: int_triac/pwm_f (triac/pwm_f code: 010) remark: the interrupt priority must be set at the beginning of the main program, because at the reset reg_conf1= 00000000, this condition could generate wrong operations. further, changing the priority levels must be avoided in interrupt service routines. when a source provides an interrupt request, and the request processing is also enabled, the cu changes the normal sequential flow of a program by transferring program control to a selected ser- vice routine. when an interrupt occurs the cu executes a jump instruction to the address loaded in the related location of the interrupt vector and the flags are saved. when the execution returns to the original pro- figure 4.5 interrupt configuration registers 17 and 18 d0 d1 d2 d3 d4 d5 d6 d7 int 1 not used int 2 reg_conf17 interrupts priority d8 d9 d10 d11 d12 d13 d14 d15 reg_conf18 int 3 int 5 int 4 table 4.3 conf. registers 17-18 description bit name value level 0, 1, 2 int1 peripheral high 3, 4, 5 int2 peripheral mediumhigh 6, 7, 8 int4 peripheral mediumlow 9, 10, 11 int5 peripheral low 12, 13, int6 peripheral very low
st52t400/t440/e440/t441 41/94 gram, the flags are restored and the program con- tinues from the instruction immediately following the interrupted instruction. 4.6 interrupts and low power mode all interrupts allow the processor to leave wait mode. only an external interrupt request allows the processor to leave halt mode: if the interrupt is masked, the related interrupt routine is not ser- viced and the program continues from the first instruction after the halt instruction. 4.7 interrupt reset when an interrupt request is sent but the interrupt is masked, it isnt serviced and remains pending, so that when the interrupt is enabled it is serviced immediately. in order to avoid this from happen- ing, the pending interrupt request can be reset with the instruction rint j , which resets the interrupt j -th where j identify the peripherals as described in the following table (see table 4.4). the assembler instruction: rint 2 resets the triac/pwm_f interrupt. warning: if an interrupt is reset, with the rint instruction within its own interrupt routine, the priority level of the interrupt becomes the lowest and the routine can be immediately interrupted by a lower priority interrupt request. (*) not used in st52x400 devices figure 4.6 example of a sequence of interrupt requests table 4.4 rint instruction code peripheral name value analog comparator (*) 0 pwm/timer 1 triac/f 2 int_triac/r 3 int_triac/p 4 external interrupt 5 main program 5 4 3 2 1 0 int2 int0 int2 int1 int2 int3 int4 main program priority level int2 int0 int4 int1 int3 6
st52t400/t440/e440/t441 42/94 5 clock, reset & power saving mode 5.1 clock system the st52x400/440/441 clock generator module generates the internal clock for the internal con- trol unit, alu and on-chip peripherals and is designed to require a minimum of external compo- nents. the st52x400/440/441 oscillator circuit gener- ates an internal clock signal with the same period and phase as at the oscin input pin. the maxi- mum frequency allowed is 20 mhz . the system clock may be generated by using either a quartz crystal, ceramic resonator (cer- aloc), or an external clock. the different clock generator options connection methods are illustrated in oscillator connec- tions.when an external clock is used, it must be connected to the pin oscin while oscout should be left floating. the crystal oscillator start-up time is a function of many variables: crystal parameters (especially r s ), oscillator load capacitance (cl), ic parame- ters, environment temperature, supply voltage. it must be observed that the crystal or ceramic lead and circuit connections must be as short as possible. typical values for cl1, cl2 are 10pf for a20mhzcrystal. figure 5.1 oscillator connections oscin oscout st52x440 oscin st52x440 oscout crystal clock external clock cl1 10pf cl2 10pf c l oc k i n p u t
st52t400/t440/e440/t441 43/94 5.2 reset there are four sources of reset: - reset pin (external source) - watchdog (internal source) - power on reset (internal source) - brown out reset (internal source) when a reset event happens, all the registers are set to the reset value and the user program restarts from the beginning. 5.2.1 external reset. the reset pin is an input pin. an internal reset does not affect this pin. a reset signal originated by external sources is recognized istantaneously. the reset pin may be used to ensure vdd has risen to a point where the mcu can operate correctly before the user program is run. in working mode the reset must be set to 1 (see table 1.1) 5.2.2 reset operation. the duration of a reset condition is fixed at 1.000.000 internal cpu clock cycles (or 4096 in case of bod). following a power-on reset event, or after exit- ing halt mode, a 1.000.000 cpu clock cycle delay period is initiated in order to allow the oscillator to stabilize and to ensure that recovery has taken place from the reset state. a pull up resistor of 100 k w guarantees that reset pin is at level 1 when no halt or power-on events occurred. if an external resistor is connected to the reset pin a minimum value of 10k w must be used. after a reset procedure is completed, the core reads the instruction stored in the first 3 bytes of the eprom, which contains a jump instruction to the eprom address containing the first instruc- tion of the user program. the assembler tool auto- matically generates this jump instruction with the first instruction address. 5.2.3 power-on reset (por). a power-on reset is generated by an on-chip detection circuit. this circuit ensures that the device is not started until vdd has reached the nominal level of 2.3v and allows the clock oscilla- tor to stabilize. once 2.3v are reached, the power-on circuit gen- erates an internal rst signal that releases the internal reset to the cpu and invokes a delay counter of 1.000.000 cpu clock cycles, during which the device is kept in reset after vdd has risen. a correct operation of power-on detector is guar- anteed if the slew rate of vdd is 0.05 v/ms. note: the power supply must fall below 0 v for the internal por circuit to detect the next rise of vdd. at power on the por is enabled by default. por is designed exclusively to cope with power- up conditions and should not be used to detect a drop in the power supply voltage, for which the brown-out detector can be used instead. figure 5.2 reset block diagram power-on reset vdd vdd reset counter x 1.000.000 brown- out vdd counter x 4096 watchdog in t er n a lr e s e t wa t chdog r e s e t b r ow n - o ut r e se t
st52t400/t440/e440/t441 44/94 5.2.4 brown-out detector (bod). the on-chip brown-out detector circuit prevents the processor from falling into an unpredictable state if the power supply drops below a certain level. when vdd drops below the brown-out detection level, the brown-out causes an internal proces- sor reset rst that remains active as long as vdd remains below the brown-out trigger level. brown-out resets the entire device except the power-on detector and the brown-out itself. enabling/disabling the brown-out detector can be performed by setting the software of the control bit bod of reg_conf0 (table 4.1). when vdd increases above the trigger level, the brown-out reset is turned off after a delay of 4096 cpu clock cycles, which ensures stab ilization of the oscillator. the brown-out falling voltage level typical value is 3.8v and the corresponding rising voltage activa- tion level is 4.1v. a minimum hysteresis of 250mv for the trigger is guaranteed for spike free brown-out detection. brown-out circuit detects a drop if vdd voltage stays below the safe threshold for longer than 100 clock cycles before activation/deactivation of the brown-out in order to filter voltage spikes. brown-out function is disabled by default and is not active when in halt mode. remark : for higher frequencies, the device needs supply voltage higher than the bod threshold. for this reason the bod cannot work in this range of frequencies. see electrical characteristic chapter in this datasheet. 5.3 power saving modes there are two power saving modes: wait and halt mode. these conditions may be entered by using the wait and halt instructions. 5.3.1 wait mode. wait mode places the mcu in a low power con- sumption by stopping the cpu. all peripherals and the watchdog remain active. during wait mode, the interrupts are enabled. the mcu will remain in wait mode until an interrupt or a reset occurs, whereupon the program jumps to the interrupt service routine or, if a reset occurs, at the beginning of the user program. remark: in wait mode the cpu clock doest stop. 5.3.2 halt mode. halt mode is the mcus lowest power consump- tion mode, which is entered by executing the halt instruction. the internal oscillator is turned off, causing all internal processing to be stopped, including the operations of the on-chip peripher- als. halt mode cannot be used when the watchdog is enabled. if the halt instruction is executed while the watchdog system is enabled, it will be skipped without modifying the normal cpu opera- tions. theicucanexithaltmodeafteranexternalinter- rupt or reset. the oscillator is then turned on and stabilization time is provided before restarting cpu operations. stabilization time is 4096 cpu clock cycles after the interrupt and 1.000.000 after the reset. after the start up delay, the cpu restarts opera- tions by serving the external interrupt routine. reset makes the icu exit from halt mode and restart, after the delay, from the beginning of the user program after the delay. warning : if the external interrupt is disabled, the icu exits from the halt mode and jumps to the lower priority interrupt routine. figure 5.3 wait flow chart
st52t400/t440/e440/t441 45/94 figure 5.4 halt flow chart halt instruction watchdog enabled halt instruction skipped yes no oscillator off peripherals clock off cpu clock off yes 4096 cpu clock cycles delay restart program servicing the external interrupt routine external interrupt no yes no external interrupt enabled restart program servicing the lower priority interrupt routine yes no reset reset cpu and restart user program oscillator on peripherals clock on cpu clock on 1000000 cpu clock cycles delay oscillator on peripherals clock on cpu clock on
st52t400/t440/e440/t441 46/94 6i/oports 6.1 introduction st52x400/440/441 devices offer flexible individu- ally programmable multi-functional input/output lines. refer to chapter 1 for specific pin alloca- tions. 21 i/o lines, grouped in 3 different ports, are avail- able for st52x400g/440g / 441g devices: port a = 8-bit ports (pa0 - pa7 pins) port b = 8-bit ports (pb0 - pb7 pins) port c = 5-bit port (pc0 - pc4 pins) 13 i/o lines, grouped in 2 different ports are avail- able for st52x400f/440f/441f devices: port a = 8-bit ports (pa0 - pa7 pins) port b = 5 -bit ports (pb0 - pb3 and pb7 pins) these i/o lines can be programmed to provide digital input/output or analog input, or to connect input/output signals to the on-chip peripherals as alternate pin functions. the input buffers are ttl compatible with schmitt trigger in ports a and c while port b is cmos compatible without schmitt trigger and it is used for the analog inputs. the output buffer can supply up to 8 ma. all the port pins of 400/440 devices have an internal pull-up resistor (22 k w ). the 441 device doesnt have internal pull-up resistor. this pull-up resistor is automatically excluded when the pin is configured as analog input or, in main1 and main2 pins, when the triac driver is configured in phase angle partializa- tion or burst mode. each single port pin can be programmed in input or output or alternate function, so that in the same port there can be both input and output pins. the port pins are write/read in parallel at the same time: when reading output pins, the port buffer contents are read; when writing an input pin the value is written in the buffer. each port is configured by using configuration registers indicated in table 6.1. the first is used to define if a pin is an input or an output, the sec- ond defines the alternate functions. (*) not available in st52x400f/440f/441f (**) only in st52x440f /441f table 6.1 i/o port configuration register port a port b port c (*) reg_conf 4 reg_conf 13 reg_conf 11 reg_conf 12 reg_conf 14 reg_conf 11** figure 6.1 ports a and c functional blocks ttl port a pin or port c pin to input register and peripherals from peripheral from output register from configuration register from configuration register vcc 22 k
st52t400/t440/e440/t441 47/94 6.2 input mode the input configuration is selected setting the cor- responding configuration register bit in reg_conf4, reg_conf13 and, where appli- cable, reg_conf11 (see paragraph i/o port configuration registers) to 1. to use port a and b pins as digital input, the corresponding bits in reg_conf12 and reg_conf14 must be set according to the values shown in table 6.4, table 6.5 and table 6.6. (*) not used for st52x400f/440f/441f (*) not used for st52x400f/440f/441f digital input data is automatically stored in the input registers (see table 6.2), but the single bit of the input register (ir) cannot be read directly and the value in a ram location must be copied. digital data is stored in a ram location by using the assembler instruction: ldri regx,inpy then, each single bit can be examined by using and and or operators with a suited mask value. 6.3 output mode the output pin configuration is selected by setting the corresponding configuration register bit to 0 (reg_conf4, reg_conf13 and, where appli- cable, reg_conf11) (see paragraph i/o port configuration registers). in order to use port a and b pins as digital output, the corresponding bits in reg_conf12 and reg_conf14 must be set according to the values illustrated in tables - port a - reg_conf 4, - port a - reg_conf 12 and analog inputs reg_conf 14. digital data is transferred to the related i/o port by means of the output register (see table 6.3), by using the assembler instructions ldpe or ldpr that respectively take the value to be transferred to the ports from eprom and ram. figure 6.2 port b functional blocks to a/d converter cmos port b pin from configuration register to input register from output registers from configuration register 22 k vcc table 6.2 input register and i/o ports port a port b port c (*) ir 14 ir 15 ir 16 table 6.3 output register and i/o ports port a port b port c (*) or 0 or 1 or 2
st52t400/t440/e440/t441 48/94 6.4 alternate functions. port a and b pins in st52x400/440/441 are con- figurabletobeusedwithdifferentfunctions(alter- nate functions) related to the use of peripherals. to configure a pin in alternate function the related configuration registers must be set according to the values shown in tables - port a - reg_conf 4, - port a - reg_conf 12 and analog inputs reg_conf 14. for example: if pin pa5/tclk has to be used as an external pwm/timer clock, reg_conf4[(5)] bit must be set to 1. when the signal is an input of an on-chip peripheral, the related i/o pin has to be config- ured in input mode . when a pin of port b is used as an analog input, the related i/o pin is automatically set in threes- tate. the analog multiplexer (controlled by the analog comparator configuration register) switches the analog voltage present on the selected pin to the common analog rail, which is connected to the adc input. it is recommended that the voltage level or loading on any port pin not be changed while conversion is running. furthermore, it is recommended not to have clocking pins located close to a selected analog pin. 6.5 i/o port configuration registers the i/o mode for each bit of the three ports are selected by using configuration registers 4, 12, 13 and 11 (table 6.1). the structure of these reg- isters is illustrated in tables - port a - reg_conf 4, - port a - reg_conf 12, - port b - reg_conf 13, analog inputs reg_conf 14 and - port c - reg_conf 11. each bit of the con- figuration registers sets the i/o mode of the related port pin. analog comparator inputs pins pb0-pb7 for st52x440g/441g and pb0- pb3 and pb7 in st52x440f/441f can be config- ured to be analog inputs by setting the related bit in reg_conf 14 to 1 (table 6.7) and the related bit in reg_conf13 to 1 (table 6.6). these analog inputs are connected to the on chip analog comparator. if the bandgap reference (bg) is needed as an output for st52x440g/441g reg_conf13[6] must be set to 0 and reg_conf14[6] to 1. timer/pwm alternate functions pins of port a can be configured to be i/os of the on-chip timer/pwm of st52x400/440/441. the configuration of these pins is performed by using configuration registers reg_conf4 and reg_conf12 (tables - port a - reg_conf 4 and - port a - reg_conf 12). if a pin has to be a timer input (tstrt, tclk, tres) the related bit of reg_conf4 must be set to 1 and of reg_conf12 must be set to 1. if, instead it must be a timer output (tout, toutn), reg_conf12 related bit must be set to 0 and the related bit of reg_conf4 be set to 0. triac driver alternate function when using the on-chip triac, to have the triac output on pin pa0, bit reg_conf12[0] must be set to 0 and reg_conf4[0] to 0. when a synchronization with the mains voltage is necessary, in case either the phase angle partial- ization or the burst modes is chosen, to have main1 and main2 as inputs on porta, it is neces- sarytosetbits1and2ofreg_conf4to1. ( *) not available in st52x400xx table6.4 -porta-reg_conf4 bit name value pin description 0d0 x pa0 1 d1 x pa1/main1 2 d2 x pa2/main2 3 d3 x pa3/acstrt(*) 4 d4 x pa4/tstrt 5 d5 x pa5/tclk 6 d6 x pa6/tres 7 d7 x pa7/int x = 0 pin set as digital output x = 1 pin set as alternate function input reset configuration 1111
st52t400/t440/e440/t441 49/94 (*) not available in st52x400xx ( *) not available in st52x400f/440f/441f (*) not available in st52x400xx (**) not available in st52x440f/441f (*) not used in st52x400f/440f/441f (**) must be set to 1 table6.5 -porta-reg_conf12 bit name value pin description 0 d0 x pa0/trout 1 d1 x pa6/tout 2 d2 x pa2/toutn 3 d3 x pa7/acsync(*) 4 d4 not used 5 d5 not used 6 d6 not used 7 d7 not used x = 0 pin set as alternate function output x = 1 pin set as digital i/o reset configuration 1111 table6.6 -portb-reg_conf13 bit name value related pin 0 d0 x pb0 1 d1 x pb1 2 d2 x pb2 3 d3 x pb3 4 d4 x pb4(*) 5 d5 x pb5(*) 6 d6 x pb6(*) 7 d7 x pb7 x = 0 pin set as output x = 1 pin set as input reset configuration 11111111 table 6.7 analog inputs reg_conf 14 bit name value pin description 0 d0 x pb0/ac0(*) 1 d1 x pb1/ac1(*) 2 d2 x pb2/ac2(*) 3 d3 x pb3/ac3(*) 4 d4 x pb4/ac4(*)(**) 5 d5 x pb5/ac5(*)(**) 6 d6 x pb6/bg(*)(**) 7 d7 x pb7/cs(*)(**) x = 0 pin set as digital i/o x = 1 pin set as analog input reset configuration 00000000 table6.8 -portc-reg_conf11 bit name value related pin 0 d0 x pc0 (*) 1 d1 x pc1 (*) 2 d2 x pc2 (*) 3 d3 x pc3 (*) 4 d4 x pc4 (*) 5d51 (**) 6 d6 not used 7 d7 not used x = 0 pin set as digital output x = 1 pin set as digital input reset configuration 11111111
st52t400/t440/e440/t441 50/94 7 analog comparator (st52x440/441) 7.1 analog module overview the st52x440/441 includes an analog compara- tor (ac) among its peripherals. the analog comparator is endowed with analog and digital elements in order to also allow the user to make use of it as a single slope analog to digi- tal converter. in particular, st52x440/441 is endowed with: n analog comparator; n 7 channels analog mux (6 external lines, 1 internal voltage reference); n a current source providing 7 programmable values; n 16 bit timer with a capture register and 12 bit prescaler; the analog comparator peripheral can also be used as a single slope a/d, supplying a ramp sig- nal to the pin cs. the selection of the working mode, as either analog comparator or single slope a/d can be performed via the reg_conf3[(0)] bit. 7.2 comparator mode in analog comparator mode, reg_conf3[(0)] is set to 0. the ac inputs are available on the external pins. the reference signal must be con- nected to the cs pin, the signal to be compared goes to the analog input ac0. when the input becomes lower than the refer- ence, the analog comparator output changes to value 1. the output can be read on the less sig- nificative bit of input register 1 ac_chan0h (table 2.1). 7.3 a/d converter mode to use the analog comparator for a/d conver- sion, reg_conf3[(0)] bit must be set to 1. in a/d mode either the insertion of an external capacitor to pin cs or the connection to an exter- nal signal to generate the reference ramp may be chosen. in the first case reg_conf16[(1)] bit must be set to 0. the internal current generator, utilized to charge the capacitor, provides 7 possible current values, which can be selected via reg_conf3[(7:5)]. the current values are in the range between 0 to 70 m awithstepof10 m a. the capacitor should have a low voltage coeffi- figure 7.1 analog peripheral block diagram ac0 ac1 cs bandgape ref.=2.5v vcc + - 1 6 b i t t i m e r s to p c o un t 1 2 b i t p r e s c. c l k ti m e r c lk a/d configuration registers 7 6 5 43210 a / d c o n f i g u r a t i o n r egi s t e rs 7 6 5 4 3 2 10 s t a r t current sel. c o n ve r t e d v al u e ac2 ac3 ac4 ac5 g nda 7 6 5 43210
st52t400/t440/e440/t441 51/94 cient for optimum results (recommended capaci- tance values range is 10-1000 nf). the optimum linearity in conversion can be obtained if the volt- age level on the selected input channel does not exceed a maximum of 3 v. in the second case, if an external ramp generator is used, the reg_conf16[(1)] bit must be set to 1. the 16 bit timer, directly triggered by the output of the analog comparator, allows the measurement of the conversion time that is proportional to the analog value. the device clock is divided by an internal 12 bit prescaler to generate the appropriate timer clock that allows the desired resolution to be obtained with a reasonable conversion time. when an appropriate value of the capacitor is selected, the conversion should be complete before the full count is reached. a timer overflow flag is set once the timer reaches its maximum count value. generally, the maximum conversion time of the a/ d converter depends on the capacitor chosen and the charge current. the maximum conversion time can be calculated by using the following formula: c is the capacitance in nf, fullscale is the maxi- mum voltage recommended for the input signal, which is 3 v, and chargecurrent is the configured value of the current for charging the capacitor. to obtain the desired resolution, the prescaler value has to be set in accordance to the following formula: cmk indicates the master clock frequency and resolution is the number of bits that should con- tain the converted values. recommended values for the resolution are in the range between 8-14 bits. after the capacitor is charged, it is discharged in a number of clock cycles equivalent to ( p +1) x 410. when the external ramp generator is used, a ris- ingramporafallingrampmaybechosen.inthis case, the timer counter should be specified to be either an up counter (reg_conf3[(3)]=0) or a down counter (reg_conf3[(3)]=1). by using a rising ramp the analog comparator must be configured to trigger the signal when it crosses the compared value from low to high (reg_conf3[(2)]=0); vice versa, using a falling ramp, the polarity should be set to trigger the sig- nal in crossing from high to low (reg_conf3[(2)]=1). when the capacitor is used, it generates a rising ramp. for this reason the polarity must be config- ured to trigger the crossing from low to high(reg_conf3[(2)]=0). in order to synchronize the external ramp signal and the timer, the acstrt and acsync pin have to be used. the input pin acstrt is used to start the timer when the external ramp is started (acstrt=1). the acsync output pin provides the handshake signal, which (when acsync=1) furnishes information indicating that the timer is ready to receive the start signal. if the input signal is too high, the counter may overflow. when this happens, bit 0 of the input register 13 ac_status (table 2.1) is set to 1 and an interrupt is generated at the end of count. if the counter is configured in down counting, the bit is set when the counter goes in underflow. 7.3.1 operating modes. in order to avoid the errors introduced by the a/d components drift, a periodic conversion of the internal reference signals can be performed in order to calibrate the converted values. two differ- ent internal voltage references are available: 1) bandgap voltage, this reference voltage can also be used externally for analog signal condi- tioning. 2) gnda. setting the reg_conf1[(0)] to 1 the peripheral converts the reference signal after converting each analog signal. in order to choose the refer- ence, reg_conf3[(1)] should be configured. to ensure secure and stable measurements, sev- eral measurements on the same channel and mediating the obtained results are recommended. the conversion of each single channel may be repeated up to three times by configuring the reg_conf1[(7:6)]. the analog multiplexer allows the user to work in four different modes: C single channel single conversion C single channel multiple conversions C multiple channels single conversion C multiple channels multiple conversions conversiontime ms () cnf () fullscale v () ch ecurrent ua () arg --------------------------------------------------------- - = p cnf () ckm mhz () fullscale v () 10 3 ch ecurrent ua () 2 resolution arg -------------------------------------------------------------------------------------------------------------- - 1 C =
st52t400/t440/e440/t441 52/94 the four modes are selected by configuring reg_conf1[(2)] to choose among the conver- sion of a single channel or a sequence of chan- nels and reg_conf1[(1)] to perform the conversion once or continuously. reg_conf1[(5:3)] bits allows the user to choose the channel to be converted in single channel mode or the last channel to be converted (starting from ac0) in multiple channels mode. to start the conversion, reg_conf16[(0)] must be set to 1 and to 0 to stop it. note : in single conversion modes, the start bit reg_conf16[(0)] must be reset to 0 before starting another conversion; in comparator mode it must be set to 0. reset configuration value = 00000000 reset configuration value = 00000000 the analog comparator in a/d converter mode supplies an interrupt source. the interrupt signal can be generated either after the end of the each channel conversion (reg_conf3[(4)]=0) or after. the end of the conversion sequence (reg_conf3[(4)]=1). reset configuration value = 00000000 reset configuration value = 00000000 table 7.1 configuration register 1 bit name value description 0 refm 0 convert only data 1 convert data and reference value 1 conv 0 single conversion 1 continuous conversion 2 seq 0 single channel 1 multiple channel 3 chan 000 channel 0 ac0 4 001 channel 1 ac1 010 channel 2 ac2 011 channel 3 ac3 5 100 channel 4 ac4 101 channel 5 ac5 110 not used 111 not used 6 nbcv 00 one conversion 01 two conversion 7 10 three conversion 11 not used table 7.2 configuration register 15 bit name description 7:0 pres(7:0) timer prescaler (7:0) table 7.3 configuration register 3 bit name value description 0mode 0 comparator mode 1 a/d mode 1refv 0 reference= gnda 1 reference = 2.42 v 2pol 0 rising crossing 1 falling crossing 3updw 0 up counter 1 down counter 4int 0 interrupt after each conversion 1 interrupt after the end of the conversion cycle 5 cur 000 current generator off 001 10 m a charge current 010 20 m a charge current 011 30 m a charge current 6 100 40 m a charge current 101 50 m a charge current 7 110 60 m a charge current 111 70 m a charge current table 7.4 configuration register 16 bit name value description 0 strt 0 a/d converter stopped 1 a/d converter started 1 adm od 0 capacitor ramp 1 external ramp generator 2 not used 3 7:4 pres(11:8 timer prescaler (11:8)
st52t400/t440/e440/t441 53/94 figure 7.2 configuration register 1 d7 d6 d5 d4 d3 d2 d1 d0 reg_conf 1 analog comparator refm: r e f e r e n c ec o n v er s i o n o n / o f f conv: sin g l e / co n ti n uous c o n v er s i o nmo d e seq: sing l e / m u l t i ple c han n e l m o d e chan: a c t i v e c h a nne l (s ) n um b e r nbcv: n u m b e r o f conve r s i o n figure 7.3 configuration register 3 figure 7.4 configuration register 15 figure 7.5 configuration register 16 d7 d6 d5 d4 d3 d2 d1 d0 reg_conf 3 analog comparator m o d e : w ork i n g m o de re f v :r e f er e n c evo l tage p o l : c r o s sing polar i ty up d w: u p / d o w n c o u n t e r i n t : in t e r r u p ttype cur: charge current d7 d6 d5 d4 d3 d2 d1 d0 reg_conf 15 analog comparator pr e s ( 7 : 0) : t i m e r pr e s c a l e r (7:0) d7 d6 d5 d4 d3 d2 d1 d0 reg_conf 16 analog comparator strt: converter st a r t / s t o p pres(11:8): time r p re s c a l e r ( 1 1: 8 ) admod: capacitor/external ra m p m o d e not used
st52t400/t440/e440/t441 54/94 8 watchdog timer 8.1 functional description the watchdog timer (wdt) is used to detect the occurrence of a software fault, usually generated by external interference or by unforeseen logical conditions, which causes the application program to abandon its normal sequence. the wdt circuit generates an mcu reset on expiry of a pro- grammed time period (timeout), unless the pro- gram refreshes the wdt before the end of the programmed time period itself. 16 different time delays can be selected by using the wdt configuration register reg_conf2 as in table 8.2. wdt is activated by the assembler instruction wdtrfr . at the end of the programmed time delay, wdt starts a reset cycle pulling the reset pin low. during normal operation, when wdt is active, the application program has to refresh this peripheral at regular intervals to prevent an mcu reset. wdt refresh is performed by the wdtrfr assembler instruction. to stop wdt during the user program executions instruction wdtslp has to be used. wdt working frequency is equal to master clock frequency divided by a fixed prescaler with a divi- sion factor of 500, to obtain wdt clk signal that is used to fix the wdt timeout period (figure 8.1). with a master clock of 20mhz, for instance, a wdt timeout period can be defined between 0.025ms and 234.375ms, depending on wdt reg_conf2 values. timeout delay values at different master clock fre- quencies can be calculated as the product of wdt clock number pulses (table 8.2) by wdt clk period (table 8.4). warning: changing the reg_conf2 value when the wdt is active, a wdt reset is generated and the cpu is restarted. to avoid this side effect, use the wdtslp instruction before changing the reg_conf2. table 8.1 watchdog timing range (clkm=20 mhz) wdt timeout period (ms) min 0.025 max 234.375 figure 8.1 watchdog block diagram d0 d1 d2 d3 reg_conf 2 reset wdtrfr pres clk = clk master wdtslp prescaler wdt reset generator reset wtd clk
st52t400/t440/e440/t441 55/94 8.2 register description wdt timeout period can be set by setting the first 4 bits of reg_conf2: this allows 16 different val- ues of wdt clock pulse number to be defined. the wdt clk is derived from the master clock divided by 500. timeout is then obtained by multi- plying the wdt clk period for the number of pulses defined in configuration register reg_conf2. table 8.4 illustrates the pulse length for typical values of master clock. table 8.3 illustrates the timeout wdt values when master clock is 5 mhz. table 8.2 w dt reg_co nf2 bit name value timeout values (wdt clk pulses) 0 d(3:0) 0000 1 0001 625 0010 1250 0011 1875 1 0100 2500 0101 3125 0110 3750 0111 4375 2 1000 5000 1001 5625 1010 6250 1011 6875 3 1100 7500 1101 8125 1110 8750 1111 9375 4-7 nc x not used reset configuration 0000 table 8.3 timeout values with clkm=5 mhz bit name value timeout values 0 d(3:0) 0000 0.1 0001 62.5 0010 125 0011 187.5 1 0100 250 0101 312.5 0110 375 0111 437.5 2 1000 500 1001 562.5 1010 625 1011 687.5 3 1100 750 1101 812.5 1110 875 1111 937.5 4-7 nc x not used reset configuration 0000 table 8.4 typical wdt clk period master clk (mhz) wdt clk (khz) wdt clk period (ms) 4 8 0.125 5100.1 8 16 0.0625 10 20 0.05 20 40 0.025
st52t400/t440/e440/t441 56/94 9 pwm/timer st52x400/440/441 on-chip pwm/timer periph- erals consist of an 8-bit counter with a 16-bit pro- grammable prescaler that provide a maximum count of 2 24 (figure 9.1). the timer has two different working modes: n timer mode n pwm (pulse width modulation) mode that can be selected by setting register reg_conf5[7] bit tmode. the timer has an autoreload function in pwm mode. its output tout is available, with its com- plementary signal toutn on external pins by set- ting pa6 and pa2 bits of reg_conf4 and reg_conf12 (see tables - port a - reg_conf 4 and - port a - reg_conf 12). thetimercanalsouseanexternalstart/ stop signal (input capture), an external reset and external clock signals: pa4/tstrt, pa6/ tres and pa5/tclk pins. to use tstrt, tres, tclk external signals the related pins pa4, pa6 and pa5 must be configured in input mode by set- ting registers reg_conf4 and reg_conf12 (see table - port a - reg_conf 4 and - port a - reg_conf 12). the content of the 8-bit counter of the timer is incremented on the rising edge of the 16-bit pres- caler output (prescout) and it can be read at any instant of the counting phase, which is then saved in a ram memory location. the pwm/ timer counter value can be read from the input register pwm_count (input registers 18, see table 2.1). the pwm/timer status can be read from the input register pwm_status (input registers 19. see table 2.1). this register indi- cates if the timer is in start/stop (bit 1) and in set/reset bit(0). 9.1 timer mode timer mode is selected by setting the txmode bit of reg_conf5[7]. the timer can receive three signals as inputs: timer clock (tclk), timer reset (tres) and timer start (tstrt) (figure 9.1). each of these signals can be generated internally or externally by setting tstr, trst, tclk bits of reg_conf7 register as illustrated in table 9.3. tmrclk is the prescaler output, which incre- ments the counter value on the rising edge. tmr- clk is obtained from the internal clock signal (clkm) or from the external signal provided on the pa5/tclk pin. note: the external clock signal, applied on tclk pin, must have a frequency, which is at least two times smaller than the internal master clock. the prescaler output can be selected by setting presc bits of reg_conf6 register (table 9.2). tres resets the content of the timer 8-bit counter to zero. it is generated internally by set- ting the tirst bit of reg_conf5(table 9.1). tstrt signal starts and stops the timer counting only if the peripheral is configured in timer mode. it is generated internally by setting the tstr bit of reg_conf5(table 9.1). timer start/stop can be provided externally from the tstrt pin (input capture). in this case, tstrt signal allows the icu to work in two differ- ent modes by setting the testr configuration bit of reg_conf5 register. level: when the tstrt signal is high the timer starts counting. when the tstrt is low the count- ing stops and the current value is stored in the pwmcount input register. figure 9.1 timer peripheral block diagram bit 0 bit 1 bit 2 bi t 3 bit 4 bit 5 bit 14 bi t 15 bi t 3 bit 0 bit 1 bit 2 bit 6 bit 4 bit 5 bi t 7 17 - 1 multiplexer 16-bit prescaler 8-bit counter prescx clkm tmrclk txres txstrt
st52t400/t440/e440/t441 57/94 edge: after the reset, on the first tstrt rising edge, the timer starts counting and, at the next rising edge, it stops. in this manner, the period of an external signal may be measured. the timer output signal, timerout, is a signal with a frequency equal to the 16 bit-prescaler out- put signal, tmrclk, divided by the output regis- ter pwm_count value (8 bit) (output registers 9, table 2.3), that is the value to count. timerout waveform can be of two types: type 1: tout waveform equal to a square wave with a 50% duty-cycle type 2: tout waveform equal to a pulse signal with the pulse duration equal to the prescaler out- put signal. the timer output signal waveform type can be selected by setting the correspondent tmrw bit of reg_conf6. 9.2 pwm mode pwm working mode is obtained by setting the cor- respondent tmode bit of reg_conf5 to 1. timerout, in pwm mode, consists of a signal, with a fixed period, whose duty cycle can be mod- ified by the user. timerout signal is available on tout pin and timerout complementary signal is available on toutn pin, setting the relative bits on port a, reg_conf12[1] and reg_conf12[2], to 0 and reg_conf4[6] and reg_conf4[2] to 0. the pwm timerout period can be fixed by set- ting the 16-bit prescaler output and an initial autoreload 8-bit counter value stored in the output register pwm_reload, as illustrated in figure 9.4. the output register pwm_reload value is automatically reloaded in the counter when it restarts counting. note: the start/stop and set/reset signals should be moved together in pwm mode. if the start/stop bit is reset during the pwm mode work- ing, the txout signal keeps its status until the next start. figure 9.2 timer 0 external start/stop mode level edge start stop start start stop start 01 1 0 4 4 3 2 reset clock counted value figure 9.3 timerout signal type timer output type 1 type 2 prescout*counter
st52t400/t440/e440/t441 58/94 the 16-bit prescaler divides the master clock, clkm or the external signal tclk. the prescaler output can be selected setting the presc bit of reg_conf6. note: the external clock signal, applied on tclk pin, must have a frequency that is at least two times smaller than the internal master clock. when the counter reaches the peripheral regis- ter pwm_count value (compare value), the timerout signal changes from high to low level, up to the next counter start. the period of the pwm signal is obtained by using the following formula: t= (255-pwm_reload)*tmrclk where tmrclk is the output of the 16-bit pres- caler. the duty cycle of the pwm signal is controlled by the output register pwm_count: ton =(pwm_count- pwm_reload)* tmrclk if the output register pwm_count value is 255 the timerout signal is always at high level. if the output register pwm_count is 0, or less than the pwm_reload value, timerout sig- nal is always at low level. note. if the pwm_reload value increases, the duty cycle resolution decreases. by using a 20 mhz master clock a pwm fre- quency in the range between 1.2 hz to 78.43 khz may be obtained. note: the timer, before using a new value of the counter or of the reload, has to complete the previ- ous counting. if the counter/reload value is changed during counting, the new value of the timer counter is used only at the end of the previ- ous counting phase. this happens both in timer andinpwmmode. warning: loading new values of the reload in the pwm_x_reload registers, the pwm/timer is immediately set on-fly. this can cause some side effects during the current counting cycle. the next cycles work normally. this occurs both in timer andinpwmmode. when the timer is in reset, or when the device is reset, the tout pin goes to threestate: it is rec- ommended to use a pull-up or a pull-down resistor if this output is used to drive an external device. figure 9.4 pwm mode with auto reload t t 255 compare value reload register 0 pwm output ton t
st52t400/t440/e440/t441 59/94 9.3 timer interrupt the timer can be programmed to generate an interrupt request until the end of the count or when there is an timer stop signal (tstrt). the timer can generate programmable interrupts into 4 dif- ferent modes: interrupt mode 1 : interrupt on timer stop. interrupt mode 2 : interrupt on rising edge of timerout. interrupt mode 3 : interrupt on falling edge of timerout. interrupt mode 4 : interrupt on both edges of timerout. the interrupt mode can be selected by means of intsl and inte bits of the reg_conf5. note: the interrupt on timerout rising edge is also generated after the start. warning: if the pwm/timer is configured with the interrupt on stop and the start/stop is configured as external, a low signal in the strt pin determines a pwm/timer interrupt even if the peripheral is off. if the interrupt is configured on falling edge, a reset signal generates an interrupt request. reset configuration = 00000000 table 9.1 configuration register 5 description bit name value description 0 tirst 0 internal reset 1 internal set 1 terst 0 external reset on level 1 external reset on edge 2 tistr 0 internal stop 1 internal start 3 testr 0 external start on level 1 external start on edge 4 inte 00 timer interrupt on timerout falling edge 01 timer interrupt on timerout rising edge 5 10 timer interrupt on both edges of timerout 11 - not used 6 intsl 0 timer interrupt on counter stop 1 timer interrupt on timerout edges 7 tmode 0 timer mode 1 pwm mode
st52t400/t440/e440/t441 60/94 figure 9.5 configuration register 5 d7 d6 d5 d4 d3 d2 d1 d0 tirst: timer internal reset terst: timer external reset on edge/level tistr: timer internal start testr: timer external start on edge/level inte: timer interrupt on timer0out rising/falling edge intsl: timer interrupt source selection tmode: timer working mode reg_conf 5 timer reset configuration = 00000000
st52t400/t440/e440/t441 61/94 table 9.2 configuration register 6 description bit name value description 0 presc 00000 timer clock = clkm / 1 00001 timer clock = clkm / 2 00010 timer clock = clkm / 4 00011 timer clock = clkm / 8 1 00100 timer clock = clkm / 16 00101 timer clock = clkm / 32 00110 timer clock = clkm / 64 2 00111 timer clock = clkm / 128 01000 timer clock = clkm / 256 01001 timer clock = clkm / 512 3 01010 timer clock = clkm/1024 01011 timer clock = clkm/2048 01100 timer clock = clkm/4096 4 01101 timer clock = clkm/8192 01110 timer clock=clkm/16384 01111 timer clock=clkm/32768 10000 timer clock=clkm /65536 5tmrw 0 timerout pulse type waveform 1 timerout square type waveform 6 - - not used 7 - - not used figure 9.6 configuration register 6 d7 d6 d5 d4 d3 d2 d1 d0 presc: timer prescaler tmrw: timerout waveform not used reg_conf 6 timer
st52t400/t440/e440/t441 62/94 reset configuration = 00000000 table 9.3 configuration register 7 description bit name value description 0 trst 00 timer reset internal 01 timer reset external 1 10 timer reset external or internal 11 not used 2 tstr 00 timer start internal 01 timer start external 3 10 timer start external or internal 11 not used 4tclk 0 timer clock internal 1 timer clock external 5nc0 must be kept to 0 6 nc - not used 7 nc - not used figure 9.7 configuration register 7 d7 d6 d5 d4 d3 d2 d1 d0 trst: timer reset mode tstr: timer start mode tclk: timer clock source not used reg_conf 7 timer
st52t400/t440/e440/t441 63/94 10 triac/pwm driver st52x400/440/441 offers a peripheral able to generate a trout signal on pa0 pin (able to sup- ply up to 25 ma), to drive an external device, like a triac, an igbt or a power mos. a triac/pwm driver can perform 3 different working modes according to reg_conf10(3:2) bits, mode (see table 10.3): mode = 00: pwm mode = 01": burst mode triac control (thermal regulations) mode = 1x": phase angle partialization triac control (motor control) the triac/pwm driver can be initialized by using a value fixed by a control algorithm, and stored in the register file. the value is loaded in the triac_count register (output register 9) by using the ldpr instruction and it can be read by using the ldri instruction addressing the input register 17. figure 10.1 illustrates the internal structure of the triac/pwm driver. pwm mode the pwm working mode selection can be obtained by setting reg_conf10(3:2) bits, mode, at 00" value. in this working mode, the peripheral provides a signal with a fixed period and a variable duty cycle on the trout pin. the pwm period can be generated starting from the internal master clock or an external clock sig- nal applied in main1 pin. in both cases, the clock signal is divided by a 16- bit prescaler, managed by reg_conf8 and reg_conf9 (figure 10.2). at each period, the duty cycle is fixed by an 8-bit value loaded in the triac_count register (out- put register 9). the duty cycle is proportional to the value: loading 50% duty cycle is obtained, loading 0 the output will be low (off) during all the period, loading 255 will be high (on). by using a 20 mhz clock pwm frequencies in the range between 1.2 hz to 78.4 mhz may be obtained. figure 10.1 triac/pwm driver block diagram prescaler 16 bit main1 triacout pulse generator tck reg_conf8 reg_conf9 16 2 programmab l e counter mclk 8 reg_peri p h_ 9 extclk 50/60 hz preclk p o l tck 23 4 5 6 7 01 r e g _ co n f 1 0 main2 triac/pwm dr i v e r core mclk st a r t mode re s e t
st52t400/t440/e440/t441 64/94 burst mode the burst principle is based on turning the triac device on and off for a fixed integer number of mains voltage periods, in order to control the power transferred to the load. in burst mode the peripheral provides a signal, with a fixed period t containing an integer number of pulses corresponding to the main voltage zero crossings, with a duty cycle that is proportional to the number of pulses that keep the triac on (fig- ure 10.4). the user can define the period t by means of the internal 16-bit prescaler, setting reg_conf8 and reg_conf9 (figure 10.2). t is proportional to the main voltage period and is in the range [5.10, 334233.6]s if the main frequency is 50hz. the duty cycle is fixed at each period by an 8-bit value loaded in the triac_count register (out- put register 9). the duty cycle is proportional to the value: loading 50% duty cycle is obtained, loading 0 the output will be low (off) during all the period, loading 255 will be high (on). the width and the polarity of the pulses can be programmed according to the triac device and the circuit characteristics. in order to work in burst mode, the pre-post zero- crossing of main voltage must be detected by using an external inserting circuitry connected to the main1 and main2 pins (figure 10.5). this kind of triac control is mainly used for ther- mal regulation. phaseanglepartializationmode phase angle partialization method is based on turning on the triac device only for a part (phase angle) of each main voltage period. when the phase angle is large, the energy (power) supplied to the load is low, viceversa when the phase angle is small, the energy supplied to the load is high. in order to work in phase angle partialization mode, the zero-crossing of main voltage must be detected by using an external inserting circuitry connected to the main1 and main2 pins or, optionally, only on main1 pin (figure 10.10). in this working mode, the peripheral provides eight pulses after the time corresponding to the phase angle on the trout pin, obtained by setting the triac_count 8-bit register (output register 9) and the prescaler (reg_conf8 and reg_conf9). by modifying the triac_count register the phase angle is controlled. 10.1 triac/pwm driver setting the triac/pwm peripheral can be set or reset thr ough reg_conf10(7) bit tcrst (table 10.3) in all three working modes. if the triac/pwm peripheral is set and only in pwm mode , it is possible to start or stop the internal counter of the peripheral without resetting it, through reg_conf10(5) bit tcst (table 10.3), in order to use the peripheral as an addi- tional timer. in the other modes the tcst bit must be kept to 1 . note: if tcrst is 0 (reset status) the trout pin output is in tristate. figure 10.2 triac/pwm configuration registers 8 and 9
st52t400/t440/e440/t441 65/94 10.2 pwm mode settings by using the 16-bit prescaler (reg_conf8 and reg_conf9), the pwm period can be generated by dividing the internal master clock, an external clock signal applied to pin main1, or the mains voltage frequency, using the circuit of figure 10.10. note: the external clock signal applied on main1 pin must have a frequency that is at least two times smaller than the internal master clock. the clock source can be selected by using reg_conf10(4) bit, cksl (table 10.3). the period t of the pwm signal tb (see figure 10.4) can be calculated with the following formula: t= 255*tck where tc k is the period of the signal in output of the 16-bit prescaler, according to the value stored in reg_conf8 and reg_conf9 pair (figure 10.2). by using a 20 mhz clock master a pwm fre- quency in the range 1.2 hz to 78.4khz may be obtained (table 10.1). the value to n depends on the value set by the user in the triac_count register (output reg- ister 9) by using the ldpr instruction. ton and the corresponding duty cycle can be calculated from the following formulas: ton=triac_count * tck duty=triac_count / 255 the triac_count value can be changed on fly but it is updated only at the end of the signal period. if triac_count value is 255 then toff is zero and trout signal is always equal to one during the period t. according to reg_conf10(0) configuration reg- ister bit, pol, the firing pulses polarity must be set. in pwm mode, it is possible to generate a pro- grammable interrupt in four different ways: 1) no interrupt; 2) interrupt on rising edge of the signal tb (int_r). 3) interrupt on falling edge of the signal tb (int_f) 4) interrupt on both edges of the signal tb. the interrupt sources described above are always active; they can be masked through reg_conf0(5:3) bits, intsl (see table 4.1). note: if the interrupt on the rising edge (int_r) is not masked through reg_conf0(4), the first interrupt after the start occurs with a delay of a time period t. if triac_count is 255 or 0, the first interrupt after the start (either int_r and int_f) occurs at time t. in any case for triac_count equal to 255 or 0, int_r and int_f coincide and occur at each control period t. table 10.1 pwm frequencies mclk frequencies 1/t min max 5 mhz 1.2 hz 19.6 khz 10 mhz 0.6 hz 39.2 khz 20 mhz 0.3 hz 78.4 khz figure 10.3 pwm working mode t = 255 * tck to n = i n i t _ va l u e * tc k to ff triacout t b
st52t400/t440/e440/t441 66/94 10.3 burst mode when working in burst mode, the synchronization with the mains is mandatory, therefore reg_conf10(4) bit cksl must be set to 1. (table 10.3). a square wave tb is generated with a duty cycle proportional to the power the user needs to trans- fer to the load. a pulse is generated for each zero crossing of the mains voltage included in the ton of the fixed period t. figure 10.4 illustrates the typical burst control working mode. the period t of the signal tb (figure 10.4) is: t = 255*tck the signal tck is generated by programming the 16-bit prescaler by reg_conf8 and reg_conf9 (figure 10.2). tck is equal to the mains voltage frequency (50 or 60 hz) divided by n+1, where n is an integer value in the range [0, 2 16 -1]. the value ton is proportional to the value con- tained in triac_count register (output regis- ter 9) the number of generated pulses n_pulses in trout pin is equal to: n_pulses = 2*[(n+1)*triac_count] where n is the value stored in the 16-bit prescaler. therefore it is: ton = triac_count*tck the triac_count can be changed on fly and takes effect from the following period; the pres- caler value n instead is fixed since the beginning and cannot be changed on fly. the first pulse is obtained during the first zero crossing of the main voltage and the last one is generated after clock pulses included in the time period triac_count*tck, where tck is the prescaler output, generated by using the main voltage frequency applied to main1 and main2 pins. this guarantees synchronization with the mains voltage frequency. ranges of the tb signal period depend on the power line frequency and prescaler (table 10.2). in order to drive a triac in burst mode a pulse sequence must be generated, which must be cen- tered on the zero crossing of the power line as illustrated in figure 10.7. therefore, the pre zero crossing and the post zero crossing of the power line must be detected. to detect the zero-crossing and also obtain the main voltage frequency, the user must generate main1 and main2 signals by using the circuit illustrated in figure 10.5. main1 and main2 signals are used in the block called pulse generator of the peripheral (see figure 10.1). table 10.2 trout signal period power line frequency t min max 50 hz 5.10 s 334233.60 s 60 hz 4.25 s 278528.05 s figure 10.4 burst working mode -1.5 -1 -0.5 0 0.5 1 1.5 to n tb power line t = 255 * tck
st52t400/t440/e440/t441 67/94 in particular, the pulses are generated by using the rising edge of the signal main1 and the falling edge of the signal main2. figure 10.6 illustrates the generation of the triac pulses tp. the first firing pulse for the triac is generated on the zero crossing of the power line, while the next pulses are centered on the zero crossing. gener- ally, the triac firing pulses start 1/2 tp before the zero crossing and the length of the pulses is tp, see figure 10.6. the length tp of the pulses is programmable by using a 16 bit value utp, obtained with reg_conf19 bits, utpmsb, and reg_conf20, utplsb (see figure 10.12 and table 10.5): t p =t clkm *utp the value tp is in the range [0, 3.2] ms when the clock master is 20 mhz. according to reg_conf10(0) configuration reg- ister bit, pol, the firing pulses polarity may be set; in order to obtain positive or negative gate triac currents, allowing to work respectively in i and iv quadrants, or in the ii and iii quadrants (see fig- ure 10.6). the pulses polarity can be changed on fly with immediate effect. working in the ii and iii quadrant the peripheral implements the following procedure: 1) the firing pulse is set to 1" on the rising edge figure 10.5 burst mode zero crossing circuit figure 10.6 burst mode zero crossing circuit (1) (0.5) 0.5 ig negative triac gate current ?tp positive triac gate current 1 0 power line ig ii and iii quadrants i and iv quadrants tp ?tp figure 10.7 burst mode zero crossing main1 main2 -1.5 -1 -0.5 0 0.5 main voltage triacout tp tp tp
st52t400/t440/e440/t441 68/94 of main1. 2) the firing pulse is reset to 0" after the time tp fixed by program. 3) on the falling edge of main2 the firing pulse is set to 1" 4) the firing pulse is reset to 0" after the time tp fixed by program. it is possible to generate a programmable inter- rupt in the following ways: 1) no interrupt; 2) interrupt on the rising edge of the signal tb (int_r) 3) interrupt on the falling edge of the signal tb (int_f) 4) interrupt on both edges of the signal tb. 5) interrupt on each triac pulse (int_p) if pulse width or triac_count are set to zero, no pulse on trout pin is generated and int_p interrupt does not occur. the interrupt sources described above are always active; they can be masked through reg_conf0(5:3) bits, intsl (see table 4.1). 10.4 phase angle partialization working mode in this mode triac is controlled each semi-period of the mains voltage. the power transferred to the load is proportional to the current flow angle g . this kind of triac control is suitable to drive the triac with inductive load (i.e. universal or monophase motors). figure 10.8 illustrates the relation between the phase angle a and the cur- rent flow angle g . the peripheral allows to control the phase angle or equivalently time t1 (see figure 10.9). it is pos- sible to change time t1 setting the contents of the triac_count register (output register 9). t1 is proportional to the value loaded in the triac_count register. different circuits for the zero crossing detection may be used, but main1 signal rising edge must always be synchronized with the mains voltage zero crossing and main2 signal falling edge must be synchronized with the following mains voltage zero crossing. by using the external circuit illustrated in figure 10.10, only one synchronization signal from the mains may be used, main1. in this case, reg_conf10(6) must be set to 1, main2 sig- nal coincides internally with main1 and main2 pin is left free for other functions. if main voltage fre- quency is equal to 50 hz, then tr is equal to 20 ms (figure 10.9) and t1 is: t1 =triac_count* t cklm *(n+1) being t cklm master clock period and n the pres- caler value (configuration registers 8 and 9). note : the user must verify that time t1 is not larger than a fixed time tmax (8ms at 50 hz) in order to avoid the firing of the triac in the second half period of the mains voltage and to choose a suitable prescaler value to avoid the shifting of the pulse sequence in the following semi-period. in order to avoid problems for the triac firing when the load is inductive 8 different pulses are gener- ated by the peripheral (figure 10.10). their width, equal the semiperiod ti/2, is programmable by using registers reg_conf19 (utpmsb) and reg_conf20 (utplsb) and is provided by the formula: ti/2 = t clkm *utp note: the choice of utp value must be done by the user paying attention to the fact that the dura- tion of the 8 pulses train must be such that added to t1, it does not fall into the second half period of the mains voltage. in fact by using a clock master equal to 20 mhz and the full 16 bit value by confreg19 and 20, the pulse width would be in the range [0.2, 3.28] ms. the duty cycle of ti pulse is always 50%. the choice of the pulse width must be done according to triac device specifics and must be set from the beginning of the program. to change width during program execution it is necessary to reset the peri pheral. according to reg_conf10(0) configuration reg- ister bit, pol, the firing pulses polarity must be set. a programmable interrupt may be generated in four different ways: 1) no interrupt; 2) interrupt on the rising edge of the signal main1 (int_r) 3)interrupt on the falling edge of the signal main2 (int_f) 4) interrupt on both the edges of the signal main1 5) interrupt on rising edge of first pulse after t1 (int_p) if utp is 0, trout signal remains at 0 (or 1, if pol=1), however after the time t1, the interrupt int_p is generated. the interrupt sources described above are always active; they can be masked through reg_conf0(5:3) bits, intsl (see table 4.1).
st52t400/t440/e440/t441 69/94 reset configuration = 00000000 reset configuration = 00000000 figure 10.8 phase angle partialization mode (1.5) (1) (0.5) 0 0.5 1 1 . 5 (1) (0.5) 0 0.5 1 1.5 v a2-a1 il a g phase angle current flow angle l n load a2 a1 il table 10.3 configuration register 10 bit name value description 0 pol 0 set positive output pulse polarity 1 set negative output pulse polarity 1 - - not used 2 mode 00 pwm mode 01 burst mode 3 1x phase partialization 4 cksl 0 internal clock master 1 external clock on main1 5 tcst 0 triac stop 1 triac start 6 iosl 0 set main2 as alternate function 1 main2 coinciding with main1 7 tcrst 0 triac reset 1 triac set table 10.4 configuration register 19 bit name value description 0 - 7 utpmsb output impulse width most significative bit table 10.5 configuration register 20 bit name value description 0 - 7 utplsb output impulse width least significative bit figure 10.9 phase angle partialization mode (1.5) (1) (0.5) 0 0.5 1 1.5 mains voltage 10 ms 20 msec t1 t1 tmax 8ms tr tr/2 ti
st52t400/t440/e440/t441 70/94 figure 10.10 phase angle partialization zero crossing circuit 1 2 j1 220 v ac v dd a/c C d/c adaptor 220 k  main1 figure 10.11 triac/pwm configuration registers 10 d0 d1 d2 d3 d4 d5 d6 d7 pol: pulses polarity iosl: main2 selector mode: peripheral working m o d e not used reg_conf10 triac/pwm cksl: clock selector tcst: triac stop tcrst: triac set/reset
st52t400/t440/e440/t441 71/94 figure 10.12 triac/pwm configuration registers 19 and 20 utpmsb: output pulse width utplsb: o utp u t p u l s e w i d th reg_conf20 triac/pwm d 0 d1 d2 d3 d4 d5 d6 d7 reg_conf19 triac/pwm d0 d1 d2 d3 d4 d5 d6 d7
st52t400/t440/e440/t441 72/94 11 electrical characteristics 11.1 parameter conditions unless otherwise specified, all voltages are referred to v ss. 11.1.1 minimum and maximum values. unless otherwise specified, the minimum and maximum values are guaranteed in the worst conditions of environment temperature, supply voltage and frequencies production testing on 100% of the devices with an environmental temperature at t a =25 c and t a =t a max (given by the selected temperature range). data is based on characterization results, design simulation and/or technology characteristics are indicated in the table footnotes and are not tested in production. the minimum and maximum values are based on characterization and refer to sample tests, representing the mean value plus or minus three times the standard deviation (mean 3 s ). 11.1.2 typical values. unless otherwise specified, typical data is based on t a =25 c, v dd =5v (for the 4.5 v dd 5.5v voltage range). they are provided only as design guidelines and are not tested. 11.1.3 typical curves. unless otherwise specified, all typical curves are provided only as design guidelines and are not tested. figure 11.1 pin loading conditions 11.1.4 loading capacitor. the loading condition used for pin parameter measurement is illustrated in figure 11.1. 11.1.5 pin input voltage. input voltage measurement on a pin of the device is described in figure 11.2 figure 11.2 pin input voltage 11.2 absolute maximum ratings stresses above those listed as absolute maximum ratings may cause permanent damage to the device. this is a stress rating only. functional operation of the device under these conditions is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. st52 pin c l st52 pin v in
st52t400/t440/e440/t441 73/94 table 11.1 voltage characteristics symbol ratings maximum value unit v dd -v ss supply voltage 6.5 v | v ssa -v ss | variation between digital and analog ground pins 50 mv v in input voltage on vpp v ss -0.3 to 13 v input voltage on any other pin 1) & 2) v ss -0.3 to v dd +0.3 v desd electro-static discharge voltage 4000 table 11.2 current characteristics symbol ratings maximum value unit i vdd total current in v dd power lines (source) 3) 100 ma i vss total current in v ss ground lines (sink) 3) 100 i io output current sunk by any standard i/o and control pin 25 output current source by any i/os and control pin -25 i inj(pin) injected current on v pp pin 5 injected current on reset pin 5 injected current on oscin and oscout pins 5 injected current on any other pin 4) 5 s i inj(pin) total injected current (sum of all i/o and control pins) 4) 20 table 11.3 thermal characteristics symbol ratings maximum value unit t stg storage temperature range -65 to +150 c t j maximum junction temperature 150 c notes: 1. connecting reset and i/o pins directly to v dd or v ss could damage the device if the unintentional internal reset is generated or an unexpected change of i/o configuration occurs (for example, due to the corrupted program counter). in order to guarantee safe operation, this connection has to be performed via a pull-up or pull-down resistor (typical: 4.7k w for reset, 10k w for i/os). unused i/o pins must be tied in the same manner to v dd or v ss according to their reset configuration. 2. when the current limitation is not possible, the vin absolute maximum rating must be respected, otherwise refer to i inj(pin) specification. a positive injection is induced by v in >v dd while a negative injection is induced by v in vdd while a negative injection is induced by v in st52t400/t440/e440/t441 74/94 11.3 recommended operating condition operating condition: v dd =5v 10%; t a =0/125 c (unless otherwise specified). notes: 1. it is reccomendend to insert a capacitor beetwen v dd and v ss for improving noise rejection. rec- comended values are 10 m f (electrolytic or tantalum) and/or 100 nf (ceramic). 2. a lower v dd decreasing f osc (see figure 11.3). data illustrated in the figure are characterized but not tested. figure 11.3 fosc maximum operating frequency versus vdd supply (*) (*) only digital parts of the device: the analog comparator cannot work with supply voltage lower than 4.5 v. table 11.4 recommended operating conditions symbol parameter test condition min. typ. max unit v dd 2) operating supply refer to figure 11.3 2.7 5.5 v v pp programming voltage 11.4 12 12.6 v o output voltage v ss v dd v ssa analog ground v ss -0.3 v ss v ss +0.3 f osc 1)2) oscillator frequency 1 20 mhz 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 0 2 4 6 8 10 12 14 16 18 20 functionality not guaranteed in this area functionality not guaranteed in this area functionality guaranteed in this area vdd (v) f osc. max (mhz)
st52t400/t440/e440/t441 75/94 11.4 supply current characteristics supply current is mainly a function of the operating voltage and frequency. other factors such as i/o pin loading and switching rate, oscillator type, internal code execution pattern and temperature, also have an impact on the current consumption. the test condition in run mode for all the idd measurements are: oscin = external square wave, from rail to rail; oscout = floating; all i/o pins tristated pulled to vdd t a =25 c figure 11.4 typical idd in run vs fosc figure 11.5 typical idd in wait vs fosc table 11.5 supply current in run and wait mode symbol parameter conditions typ max 3) unit i dd supply current in run mode 1) v dd =5v 5% t a =25 c f osc =2 mhz 6.48 6.48 ma f osc =4 mhz 7.95 8.16 f osc =5 mhz, 9.08 9.27 f osc =10 15.5 15.6 f osc =20 28.3 28.92 supply current in wait mode 2) f osc =2 mhz 4.4 4.41 f osc =4 mhz 6.0 6.09 f osc =5 mhz 6.6 6.89 f osc =10 12.2 12.31 f osc =20 23.0 23.07 0 5 10 15 20 25 30 35 2.0 3.0 4.0 5.0 6.0 vdd [ v ] idd [ ma ] 2m h z 4m hz 5m hz 10m h z 20m hz 0 5 10 15 20 25 30 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 vdd [ v] idd [ma ] 2m hz 4m hz 5m hz 10m hz 20m hz notes: 1. cpu running with memory access, all i/o pins in input mode with a static value at v dd (no load), all peripherals switched off; clock input (oscin driven by external square wave). 2. cpu in wait mode with all i/o pins in input mode with a static value at v dd (no load), all peripherals switched off; clock input (oscin driven by external square wave). 3. data based on characterization results, tested in production at v ddmax and f oscmax .
st52t400/t440/e440/t441 76/94 notes: 1. typical data is based on ta = 25 c 2. all i/o pins in input mode with a static value at v dd (no load) 11.5 brown-out detector characteristics notes: 1. data based on characterization results 2. measurement done with dv/dt fixed table 11.6 supply current in halt mode symbol parameter conditions typ 1) max unit i dd supply current in halt mode 2) 3.0 v vdd 5.5 v 0.6 0.68 m a table 11.7 brown-out detector symbol parameter conditions min typ max unit bod l bod threshold low 3.8 v bod h bod threshold high 4.1 v t bodl duration of filtered noise 100 clock cycles
st52t400/t440/e440/t441 77/94 11.6 clock and timing characteristics operating conditions: v dd =5v 5%, ta=0/125 c, unless otherwise specified figure 11.7 i/o rise and fall timing table 11.8 general timing parameters symbol parameters test condition min typ. max unit f osc oscillator frequency 1 20 mhz t clh clock high 25 250 ns t cll clock low 25 250 t set setup see fig. 11.6 5 t hld hold see fig. 11.6 5 t wreset minimum reset pulse f osc =20mhz 100 t wint minimum external f osc =20mhz 100 t ir input rise time see fig. 11.7 15 t if input fall time see fig. 11.7 15 t or output rise time c load =10pf 10 t of output fall c load =10pf 10 figure 11.6 data input timing t cll t clh 50% 50% 50% t set t hld clock data cp t
st52t400/t440/e440/t441 78/94 11.7 memory characteristics subject to general operating conditions for v dd ,f osc and t a , unless otherwise specified. notes: 1. minimum v dd supply voltage without losing data stored into ram (in halt mode or under reset) or into hardware registers (only in halt mode). guaranteed by construction, not tested in production. 2. data is provided only as a guideline. table 11.9 ram and registers symbol parameter conditions min. typ. max unit v rm data retention mode 1) halt mode (or reset) 1.6 v table 11.10 eprom program memory symbol parameter conditions min. typ. max unit w erase uv lamp lamp wavelength 2537 a 15 watt, sec/cm 2) t erase erase time 2) uv lamp is placed 1 inch from the device window without any interposed filters 10 20 min. t ret data retention t a =+55 c 20 years
st52t400/t440/e440/t441 79/94 11.8 esd pin protection strategy in order to protect an integrated circuit against electro-static discharge the stress must be controlled to prevent degradation or destruction of the circuit elements. stress generally affects the circuit elements, which are connected to the pads but can also affect the internal devices when the supply pads receive the stress. the elements that are to be protected must not receive excessive current, voltage, or heating within their structure. an esd network combines the different input and output protections. this network works by allowing safe discharge paths for the pins subject to esd stress. two critical esd stress cases are presented in figure 11.8 and figure 11.9 for standard pins. 11.8.1 standard pin protection in order to protect the output structure the following elements are added: -adiodetov dd (3a) and a diode from v ss (3b) - a protection device between v dd and v ss (4) in order protect the input structure the following elements are added: - a resistor in series with pad (1) -adiodetov dd (2a) and a diode from v ss (2b) - a protection device between v dd and v ss (4) figure 11.8 safe discharge path subjected to esd stress figure 11.9 negative stress on a standard pad vs. vdd out (4) in vdd vss vdd vss (2a) (2b) (3a) (3b) (1) main path path to avoid main path vss vdd out (3b) (4) in (3a) (2b) (1) vss (2a) vdd
st52t400/t440/e440/t441 80/94 11.9 port pin characteristics 11.9.1 general characteristics. subject to general operating condition for v dd ,f osc, and t a, unless otherwise specified. notes: 1. unless otherwise specified, typical data is based on t a =25 c and v dd =5 v 2. hysteresis voltage between schmitt trigger switching level. based on characterization results, not tested in production. symbol parameter condition min typ 1) max unit v il cmos type low level input voltage. port b pins. (see fig 11.13) 1.5 v ttl type schmitt trigger low level input voltage. port a and port c pins. (see fig. 11.12) 0.8 v ih cmos type high level input voltage. port b pins. (see fig 11.13) 3.3 ttl type schmitt trigger high level input voltage. port a and port c pins. (see fig. 11.12) 2.2 v hys schmitt trigger voltage hysteresis 2) 1 i l input leakage current v ss v in v dd 1 m a i s static current consumption 3) floating input mode 200
st52t400/t440/e440/t441 81/94 subject to general operating conditions for v dd ,f osc ,andt a, unless otherwise specified. notes: 1. the i io current sunk must always respects the absolute maximum rating specified in section 11.2 and the sum of i io (i/o ports and control pins) must not exceed i vss 2. the i io sourced current must always respect the absolute maximum rating specified in section 11.2 and the sum of i io (i/o ports and control pins) must not exceed i vdd. table 11.11 output voltage levels symbol parameter conditions min typ max unit v ol 1) output low level voltage for standard i/o pin when 8 pins are sunk at same time. v dd =5v, i io =+8ma v ss + 0.4 v v oh 2) output high level voltage for standard i/ o pin when 8 pins are sourced at same time. v dd =5v, i io =- 8ma v dd - 0.5 figure 11.10 ttl-level input schmitt trigger 0.5 0.8 1.0 1.5 2.0 2.5 0 1 2 3 4 5 v=5v dd t = 25c a (typical) v(v) o v(v) i figure 11.11 port b pins cmos-level input 2.0 3.3 5.0 0 1 2 3 4 5 v=5v dd t = 25c a (typical) v(v) o v(v) i
st52t400/t440/e440/t441 82/94 subject to general operating condition for v dd ,f osc , and t a , unless otherwise specified. figure 11.12 port a and port c pin equivalent circuit (st52t400 and st52x440) figure 11.13 port b pin equivalent circuit (st52t400 and st52x440) 11.10 table 11.12 output driving current symbol parameter test conditions min typ max unit r s input protection resistor all input pins 1 k w c s pin capacitance all input pins 5 pf r pu pull-up resistor (*) all input pins 22 k w (*) st52t400 and st52x440 only v v device v v r dd ss in out s c s input/output r pu v ss v dd v input/output device ss v c s v ss s r out v in v dd v dd pu r when the triac-driver is configured in burst-mode or phase partialization the pull-up in main1 and main2 pins are disabled. when the port b pin is configured as analog input the pull-up is disabled.
st52t400/t440/e440/t441 83/94 figure 11.14 port a and port c pin equivalent circuit (st52t441) figure 11.15 port b pin equivalent circuit (st52t441) v v device v v v r dd ss ss in out s c s input/output v input/output device ss v c s v ss s r ou t v i n v dd
st52t400/t440/e440/t441 84/94 11.11 control pin characteristics 11.11.1 reset pin. subject to general operating conditions for v dd ,f osc , and t a, unless otherwise specified 11.11.2 power on reset. 11.11.3 v pp pin. subject to general operating conditions for v dd, f osc , and t a ,unless otherwise specified. notes: 1. data is based on characterization results, not tested in production. 2. hysteresis voltage between schmitt trigger switching level. based on characterization results not tested in production. 3. data is based on design simulation and/or technology characteristics, not tested in production. 4. in working mode v pp must be tied to v ss table 11.13 reset pin symbol parameter conditions min typ max unit v il input low level voltage 1) v dd =5v 2.2 3) v v ih input high level voltage 1) v dd =5v 2.8 3) v hys schmitt trigger voltage hysteresis 2) v dd =5v 0.6 3) t fn duration of filtered noise 100 ns t rst reset pulse duration 500 table 11.14 power on reset symbol parameter conditions min typ max unit p or power on reset 2.25 2.30 2.38 v table 11.15 v pp 4) pin symbol parameter conditions min typ max unit v il input low level voltage 3) v ss 0.2 v v ih input high level voltage 3) v dd -0.1 12.6
st52t400/t440/e440/t441 85/94 11.12 analog comparator characteristics operating conditions: v dd =5v , fosc = 0 , t a =90 c unless otherwise specified (*) fosc = 1,5,10, 20 mhz , v dd = 5 v, vpbo = 2 v, resolution = 8 bit, c s = 22nf, t a =25 c. 11.13 triac driver characteristics operating conditions: v dd =5v , fosc = 0 , t a =90 c notes: 1. the i io current sunk must always respects the absolute maximum rating specified in section 11.2 and the sum of i io (i/o ports and control pins) must not exceed i vss 2. the i io sourced current must always respect the absolute maximum rating specified in section 11.2 and the sum of i io (i/o ports and control pins) must not exceed i vdd. table 11.16 analog comparator characteristics symbol parameter conditions min typ max unit res resolution a/d converter mode 8 bit v bg band gap voltage pbx in analogic input i g =10ua cs=10nf fosc = 4 mhz 2.52 v pbx in analogic input i g =10ua cs=10nf fosc = 10 mhz 2.62 v pbx in analogic input i g =10ua cs=10nf fosc = 20 mhz 2.67 v v off input offset voltage input differential voltage range [-100, +100] mv 1.8 2.4 10 mv i cs capacitor charging current (measured i g ) i g= 10 m a(*) 8.2 9.7 10.5 m a i g= 20 m a(*) 16.7 19.4 21.6 m a i g= 40 m a(*) 33.3 38.0 43.3 m a table 11.17 triac driver characteristics symbol parameter conditions min typ max unit v ol output low level voltage when i io =50ma v dd =5v,i io = +50 ma v ss + 0.7 v v oh output high level voltage when i io =50ma v dd =5v,i io = -50 ma v dd - 0.9
st52t400/t440/e440/t441 86/94 table 11.18 s020 package mechanical data dim mm inch. min typ. max min typ. max a 2.35 2.65 0.093 0.104 a1 0.1 0.3 0.004 0.012 b 0.33 0.51 0.013 0.020 c 0.23 0.32 0.009 0.013 d 12.6 13 0.496 0.512 e 7.4 7.6 0.291 0.299 e 1.27 0.050 h 10 10.65 0.394 0.419 h 0.25 0.75 0.010 0.030 l 0.4 1.27 0.016 0.050 k 0 (min.) 8 (max.)
st52t400/t440/e440/t441 87/94 table 11.19 sop28 package mechanical data dim mm inch. min typ. max min typ. max a 1.55 1.75 0.061 0.069 a1 0.10 0.25 0.004 0.010 b 0.20 0.30 0.008 0.012 b1 0.18 0.25 0.007 0.010 d 9.80 9.98 0.386 0.393 f 5.79 6.20 0.228 0.244 e 0.64 0.025 e 3.80 3.98 0.15 0.157 l 0.40 0.90 0.016 0.035 s8 8
st52t400/t440/e440/t441 88/94 table 11.20 pdip28 package mechanical data dim mm inch. min typ. max min typ. max a 5.08 0.200 a1 0.38 0.015 a2 3.56 4.06 0.140 0.160 b 0.38 0.51 0.015 0.020 b1 1.52 0.060 c 0.20 0.30 0.008 0.012 d 36.83 37.34 1.450 1.470 d2 33.02 1.300 e 15.24 0.600 e1 13.59 13.84 0.535 0.545 e1 2.54 0.100 ea 14.99 0.590 eb 15.24 17.78 0.600 0.700 l 3.18 3.43 0.125 0.135 s 1.78 2.08 0.070 0.082 a 0 10 0 10 n28 28
st52t400/t440/e440/t441 89/94 table 11.21 dip20 package mechanical data dim mm inch. min typ. max min typ. max a1 0.508 0.020 b 1.39 1.65 0.055 0.065 b 0.45 0.018 b1 0.25 0.010 d 25.4 1.000 e 8.5 0.335 e 2.54 0.100 e3 22.86 0.900 f 7.1 0.279 i 3.93 0.155 l 3.3 0.130 z 1.34 0.053
st52t400/t440/e440/t441 90/94 table 11.22 cdip28w package mechanical data dim mm inch. min typ. max min typ. max a 5.72 0.225 a1 0.51 1.40 0.020 0.055 a2 3.91 4.57 0.154 0.180 a3 3.89 4.50 0.153 0.177 b 0.41 0.56 0.016 0.022 b1 1.45 0.057 c 0.23 0.30 0.009 0.012 d 36.50 37.34 1.437 1.470 d2 33.02 1.300 e 15.24 0.600 e1 13.06 13.36 0.514 0.526 e 2.54 0.100 ea 14.99 0.590 eb 16.18 18.03 0.637 0.710 l 3.18 4.10 0.125 0.161 s 1.52 2.49 0.060 0.098 ? 8.89 0.350 a 4 11 4 11 n28 28
st52t400/t440/e440/t441 91/94 table 11.23 cdip20w package mechanical data dim mm inch. min typ. max min typ. max a 3.63 0.143 a1 0.38 0.015 b 3.56 0.46 0.56 0.140 0.018 0.022 b1 1.14 12.70 1.78 0.045 0.500 0.070 c 0.20 0.25 0.36 0.008 0.010 0.014 d 24.89 25.40 25.91 0.980 1.000 1.020 d1 22.86 0.900 e1 6.99 7.49 8.00 0.275 0.295 0.315 e 2.54 0.100 g 6.35 6.60 6.86 0.250 0.260 0.270 g1 9.47 9.73 9.98 0.373 0.383 0.393 g2 1.14 0.045 l 2.92 3.30 3.81 0.115 0.130 0.150 s 12.70 0.500 ? 4.22 0.166 n 20
st52t400/t440/e440/t441 92/94 ordering information each device is available for production in user programmable version (otp) as well as in factory programmed version (fastrom). otp devices are shipped to customers with a default blank con- tent ffh, while fastrom factory programmed parts contain the code sent by the customer. there is one common eprom version for debug- ging and prototyping which features the maximum memory size and peripherals of the family. care must be taken to only use resources available on the target device.in order to obtain a list of part numbers see st52t400/t440/e440/t441 sales type list at the beginning of the datasheet. figure 11.16 device type codes st52 t nnn c m p y t e m p e r at u re r a ng e : 6 = - 4 0 t o 8 5c p a ck a g e s : b = p d i p m = p s o m e m o r y s iz e : 0 = 1kb 1 = 2kb 2 = 4kb 3 = 8kb p i n cou n t : f =20 p in g = 2 8 p i n s u b f a m i l y : 400 440 memory type: t =otp e =eprom fa m i l y
st52t400/t440/e440/t441 93/94
94/94 full product information at http://www.st.com/five information furnished is believed to be accurate and reliable. however, stmicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. no license is granted by implication or otherwise under any patent or patent rights of stmicroelectronics. specification mentioned in this publication are subject to change without notice. this publication supersedes and replaces all information previously supplied. stmicroelectronics products are not authorized for use as critical components in life support devices or systems without express written approval of stmicroelectronics. the st logo is a registered trademark of stmicroelectronics ? 2002 stmicroelectronics C printed in italy C all rights reserved stmicroelectronics group of companies australia - brazil - china - canada - finland - france - germany - hong kong - india - israel - italy - japan - malaysia - malta - morocco - singapore - spain - sweden - switzerland - united kingdom - u.s.a. http://www.st.com


▲Up To Search▲   

 
Price & Availability of ST52T441FMPY

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X